git: c7919fb92d20 - main - netlink: Do not cast to int in NLMSG_HDRLEN and _NLMSG_LEN

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Tue, 10 Dec 2024 18:12:59 UTC
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/src/commit/?id=c7919fb92d201ab1d5bd3ab0c18cbcea961ef761

commit c7919fb92d201ab1d5bd3ab0c18cbcea961ef761
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2024-10-29 18:41:34 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-12-10 18:11:16 +0000

    netlink: Do not cast to int in NLMSG_HDRLEN and _NLMSG_LEN
    
    Approved by: melifaro
    Sponsored by: Future Crew, LLC
    Differential Revision: https://reviews.freebsd.org/D47333
---
 sys/netlink/netlink.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/netlink/netlink.h b/sys/netlink/netlink.h
index 5724385271fc..e677365b9a21 100644
--- a/sys/netlink/netlink.h
+++ b/sys/netlink/netlink.h
@@ -210,11 +210,11 @@ enum nlmsginfo_attrs {
 /* part of netlink(3) API */
 #define NLMSG_ALIGNTO			NL_ITEM_ALIGN_SIZE
 #define NLMSG_ALIGN(_len)		NL_ITEM_ALIGN(_len)
-#define NLMSG_HDRLEN			((int)sizeof(struct nlmsghdr))
+#define NLMSG_HDRLEN			(sizeof(struct nlmsghdr))
 #define NLMSG_LENGTH(_len)		((_len) + NLMSG_HDRLEN)
 #define NLMSG_SPACE(_len)		NLMSG_ALIGN(NLMSG_LENGTH(_len))
 #define NLMSG_DATA(_hdr)		NL_ITEM_DATA(_hdr, NLMSG_HDRLEN)
-#define	_NLMSG_LEN(_hdr)		((int)(_hdr)->nlmsg_len)
+#define	_NLMSG_LEN(_hdr)		((_hdr)->nlmsg_len)
 #define	_NLMSG_ALIGNED_LEN(_hdr)	NLMSG_ALIGN(_NLMSG_LEN(_hdr))
 #define	NLMSG_OK(_hdr, _len)		NL_ITEM_OK(_hdr, _len, NLMSG_HDRLEN, _NLMSG_LEN)
 #define NLMSG_PAYLOAD(_hdr,_len)	(_NLMSG_LEN(_hdr) - NLMSG_SPACE((_len)))
@@ -223,7 +223,7 @@ enum nlmsginfo_attrs {
 #else
 #define NLMSG_ALIGNTO 4U
 #define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1))
-#define NLMSG_HDRLEN ((int)NLMSG_ALIGN(sizeof(struct nlmsghdr)))
+#define NLMSG_HDRLEN (NLMSG_ALIGN(sizeof(struct nlmsghdr)))
 #endif
 
 /*