diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2020-06-23 01:07:41 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-06-24 05:27:09 +0200 |
commit | 6f3934576853a4fa60dea74ac8822f0f016ef9e8 (patch) | |
tree | 04951421e617a66f3d9d007a57db9092de5d605f /include/net/rpl.h | |
parent | xirc2ps_cs: remove dev null check from do_reset(). (diff) | |
download | linux-6f3934576853a4fa60dea74ac8822f0f016ef9e8.tar.xz linux-6f3934576853a4fa60dea74ac8822f0f016ef9e8.zip |
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>
Diffstat (limited to 'include/net/rpl.h')
-rw-r--r-- | include/net/rpl.h | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/include/net/rpl.h b/include/net/rpl.h index dceff60e8baf..308ef0a05cae 100644 --- a/include/net/rpl.h +++ b/include/net/rpl.h @@ -26,12 +26,6 @@ static inline void rpl_exit(void) {} /* Worst decompression memory usage ipv6 address (16) + pad 7 */ #define IPV6_RPL_SRH_WORST_SWAP_SIZE (sizeof(struct in6_addr) + 7) -static inline size_t ipv6_rpl_srh_alloc_size(unsigned char n) -{ - return sizeof(struct ipv6_rpl_sr_hdr) + - ((n + 1) * sizeof(struct in6_addr)); -} - size_t ipv6_rpl_srh_size(unsigned char n, unsigned char cmpri, unsigned char cmpre); |