net: ipv6: Use struct_size() helper and kcalloc()
authorGustavo A. R. Silva <gustavoars@kernel.org>
Mon, 22 Jun 2020 23:07:41 +0000 (18:07 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Jun 2020 03:27:09 +0000 (20:27 -0700)
commit6f3934576853a4fa60dea74ac8822f0f016ef9e8
tree04951421e617a66f3d9d007a57db9092de5d605f
parent5777cbba79ab041ccc08252abf6ea6bbd1f4c285
net: ipv6: Use struct_size() helper and kcalloc()

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes. Also, remove unnecessary
function ipv6_rpl_srh_alloc_size() and replace kzalloc() with kcalloc(),
which has a 2-factor argument form for multiplication.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/rpl.h
net/ipv6/exthdrs.c
net/ipv6/rpl_iptunnel.c