Gustavo A. R. Silva
bb3e16ad8b
net, decnet: 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[];
};
instance = kzalloc(sizeof(struct foo) + count * sizeof(struct boo), 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: David S. Miller <davem@davemloft.net >
2019-01-16 13:22:10 -08:00
..
2018-12-19 00:28:05 +01:00
2018-12-25 17:07:49 +09:00
2017-11-21 15:57:07 -08:00
2018-12-06 13:26:07 -08:00
2018-06-28 10:40:47 -07:00
2018-10-23 10:57:06 -07:00
2018-12-30 14:07:54 -08:00
2019-01-03 18:57:57 -08:00
2018-12-27 13:53:32 -08:00
2018-12-10 18:00:43 -08:00
2019-01-11 18:05:41 -08:00
2019-01-11 18:26:01 -08:00
2018-10-23 10:57:06 -07:00
2019-01-07 05:17:51 -08:00
2019-01-07 22:47:48 +01:00
2019-01-16 05:13:36 +12:00
2018-07-27 13:17:50 -07:00
2018-12-28 12:11:47 -08:00
2019-01-16 13:22:10 -08:00
2018-10-04 09:40:52 -07:00
2018-12-16 14:23:33 -08:00
2018-12-03 15:40:30 -08:00
2017-10-25 13:00:27 +09:00
2018-12-24 16:19:56 -08:00
2018-04-22 21:12:00 -04:00
2019-01-11 18:05:41 -08:00
2019-01-10 09:36:41 -05:00
2018-11-10 16:55:11 -08:00
2018-09-17 18:43:42 -07:00
2018-11-15 18:09:32 +01:00
2018-12-20 16:49:30 -08:00
2018-12-03 14:15:26 -08:00
2017-11-21 16:35:54 -08:00
2018-10-22 19:59:20 -07:00
2018-12-27 13:53:32 -08:00
2018-09-28 12:46:07 +08:00
2018-10-16 00:14:07 -07:00
2018-11-27 16:37:20 -08:00
2019-01-06 09:46:51 +09:00
2018-09-21 18:58:34 -07:00
2018-12-14 11:44:31 -08:00
2018-12-30 20:24:16 -08:00
2018-12-23 16:01:35 -08:00
2018-07-12 16:55:29 -07:00
2019-01-04 13:00:02 -08:00
2019-01-08 21:41:40 -05:00
2018-12-23 16:01:35 -08:00
2017-11-01 12:19:03 +09:00
2018-07-05 20:20:03 +09:00
2019-01-07 07:22:36 -08:00
2018-12-18 13:13:56 +01:00
2018-06-28 10:40:47 -07:00
2018-11-15 11:35:40 -08:00
2018-12-27 13:04:52 -08:00
2018-12-28 12:11:47 -08:00
2019-01-07 14:40:27 -05:00
2018-10-15 12:23:19 -07:00
2019-01-03 18:57:57 -08:00
2018-12-12 16:34:22 -08:00
2019-01-07 11:42:08 -05:00
2018-12-21 15:06:20 -08:00
2018-10-23 10:57:06 -07:00
2019-01-15 20:38:29 -08:00
2018-07-24 14:10:42 -07:00
2018-12-27 13:53:32 -08:00
2018-11-29 14:25:36 -08:00
2018-12-19 21:45:17 +01:00
2018-12-20 11:53:36 -08:00
2019-01-03 18:57:57 -08:00
2018-12-19 11:21:37 -08:00
2018-06-28 13:36:39 +09:00
2018-12-28 12:45:04 -08:00
2018-03-27 13:18:09 -04:00