Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c19b0ad authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

netlink: avoid memset of 0 bytes sparse warning



A netlink attribute padding of zero triggers this sparse warning:

include/linux/netlink.h:245:8: warning: memset with byte count of 0

Avoid the memset when the size parameter is constant and requires no padding.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c0103606
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -242,6 +242,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
	nlh->nlmsg_flags = flags;
	nlh->nlmsg_pid = pid;
	nlh->nlmsg_seq = seq;
	if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
		memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
	return nlh;
}