summaryrefslogtreecommitdiffstats
path: root/net/llc
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2019-04-03 12:02:36 -0500
committerKalle Valo <kvalo@codeaurora.org>2019-04-04 19:38:36 +0300
commit95336d4cb588860283047e01050ae41993e0147d (patch)
treec926ac9bcd1f72c6851b15ea9ef3a31bef02df9e /net/llc
parent38bb0baea310fc4b5897ec47b1546bc989b33663 (diff)
downloadlinux-95336d4cb588860283047e01050ae41993e0147d.tar.bz2
qtnfmac: replace qtnf_cmd_acl_data_size() with struct_size()
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; struct boo entry[]; }; size = sizeof(struct foo) + count * sizeof(struct boo); instance = kzalloc(size, GFP_KERNEL) Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: size = struct_size(instance, entry, count); or instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL) Based on the above, replace qtnf_cmd_acl_data_size() with the new struct_size() helper. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'net/llc')
0 files changed, 0 insertions, 0 deletions