diff options
author | Patrick McHardy <kaber@trash.net> | 2008-11-20 04:08:29 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 04:08:29 -0800 |
commit | 0c19b0adb8dd33dbd10ff48e41971231c486855c (patch) | |
tree | 8cbc7b353824647f3662aeb23c3849324bffac28 /include/linux/netlink.h | |
parent | c0103606b7e3db191dcbaf988f28fa26aa711230 (diff) | |
download | blackbird-op-linux-0c19b0adb8dd33dbd10ff48e41971231c486855c.tar.gz blackbird-op-linux-0c19b0adb8dd33dbd10ff48e41971231c486855c.zip |
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: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netlink.h')
-rw-r--r-- | include/linux/netlink.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 9ff1b54908f3..51b09a1f46c3 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -242,7 +242,8 @@ __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; - memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); + if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0) + memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); return nlh; } |