summaryrefslogtreecommitdiff
path: root/drivers/extcon/Makefile
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2019-01-04 21:15:58 +0300
committerJason Gunthorpe <jgg@mellanox.com>2019-01-07 21:59:33 +0300
commit5aad26a7eac5a15f6a87ab83da8bebc3500c1915 (patch)
tree7faea6b275680f0e7aaba6515073120c6b034a5e /drivers/extcon/Makefile
parent02fc1848414e116b948ebd70e865b7539e5d7b8d (diff)
downloadlinux-5aad26a7eac5a15f6a87ab83da8bebc3500c1915.tar.xz
IB/core: Use struct_size() in kzalloc()
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; void *entry[]; }; instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL); This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/extcon/Makefile')
0 files changed, 0 insertions, 0 deletions