Gustavo A. R. Silva
06665619cc
iavf: 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;
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:
instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL)
Notice that, in this case, variable bufsz is not necessary, hence it
is removed.
This code was detected with the help of Coccinelle.
Signed-off-by: "Gustavo A. R. Silva" <gustavo@embeddedor.com >
Tested-by: Andrew Bowers <andrewx.bowers@intel.com >
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com >
2019-05-31 00:11:47 -07:00
..
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:46 +02:00
2019-05-21 12:33:38 -07:00
2019-05-15 08:46:44 -07:00
2019-05-21 10:50:46 +02:00
2019-05-05 19:34:00 +02:00
2019-05-16 09:19:14 -07:00
2019-05-21 11:28:39 +02:00
2019-05-21 11:28:46 +02:00
2019-05-21 11:28:47 +02:00
2019-05-21 11:28:40 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 12:33:38 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:52:39 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:47 +02:00
2019-05-21 10:50:46 +02:00
2019-05-30 11:27:46 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:45 +02:00
2019-05-26 13:04:12 -07:00
2019-05-21 11:28:40 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:40 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:39 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:39 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-22 08:10:35 -07:00
2019-05-30 11:36:15 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 11:28:46 +02:00
2019-05-21 11:28:46 +02:00
2019-05-21 11:28:45 +02:00
2019-05-31 00:11:47 -07:00
2019-05-21 11:28:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-13 08:52:37 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-14 10:30:10 -07:00
2019-05-21 10:50:46 +02:00
2019-05-22 08:36:16 -07:00
2019-05-21 11:28:45 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 11:28:40 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:39 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:46 +02:00
2019-05-21 11:28:40 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:40 +02:00
2019-05-17 10:08:59 -07:00
2019-05-21 11:28:45 +02:00
2019-05-26 13:04:12 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-04-25 22:23:06 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:40 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-19 09:56:36 -07:00
2019-05-21 10:50:46 +02:00
2019-05-18 11:49:57 +09:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:40 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 10:50:46 +02:00
2019-04-25 21:33:37 +02:00
2019-04-25 21:33:37 +02:00