Gustavo A. R. Silva
8d1b73dd25
kernel: module: Use struct_size() helper
...
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 module_sect_attrs {
...
struct module_sect_attr attrs[0];
};
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.
So, replace the following form:
sizeof(*sect_attrs) + nloaded * sizeof(sect_attrs->attrs[0]
with:
struct_size(sect_attrs, attrs, nloaded)
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com >
Signed-off-by: Jessica Yu <jeyu@kernel.org >
2019-06-07 10:56:32 +02:00
..
2019-05-21 12:33:38 -07:00
2019-05-21 10:50:45 +02:00
2018-10-24 20:55:56 -04:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-14 09:47:49 -07: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-24 14:17:18 -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:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-26 13:49:40 -07:00
2019-04-29 16:48:03 +02:00
2019-04-04 21:04:13 -04:00
2019-04-09 14:19:06 +02:00
2019-04-28 20:33:43 -04:00
2019-04-26 13:51:03 -04:00
2019-04-28 20:33:43 -04:00
2019-03-20 20:57:48 -04:00
2019-04-28 20:33:43 -04:00
2019-05-07 20:03:32 -07:00
2019-05-07 20:03:32 -07:00
2019-04-29 12:37:47 +02:00
2018-10-31 08:54:14 -07:00
2019-01-25 11:22:43 -08:00
2019-05-15 08:16:14 -07:00
2019-03-07 18:32:02 -08:00
2019-05-21 10:50:45 +02:00
2019-05-06 14:50:46 -07:00
2019-03-05 21:07:14 -08:00
2019-05-21 10:50:45 +02:00
2019-05-24 17:27:11 +02:00
2019-05-21 11:52:39 +02:00
2019-05-21 10:50:45 +02:00
2019-04-09 14:19:06 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-14 09:47:46 -07:00
2019-04-29 16:48:03 +02:00
2019-05-21 10:50:45 +02:00
2019-04-19 12:59:36 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50: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-03-07 18:32:02 -08:00
2019-05-03 19:42:41 +02:00
2019-05-14 09:47:50 -07:00
2018-07-16 12:31:57 -07:00
2019-04-29 16:48:03 +02:00
2019-04-16 09:38:16 +02:00
2019-05-21 10:50:45 +02:00
2019-05-14 19:52:49 -07:00
2019-05-14 19:52:47 -07:00
2019-05-14 09:47:51 -07:00
2019-05-24 17:27:11 +02:00
2019-05-24 17:27:11 +02:00
2019-06-07 10:56:32 +02:00
2019-05-21 10:50:45 +02:00
2019-04-25 22:06:11 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-03-12 13:27:20 -07:00
2019-05-21 10:50:45 +02:00
2019-04-19 12:39:32 +02:00
2019-05-07 19:06:04 -07:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-03-22 14:36:02 +01:00
2018-12-05 19:31:44 -08:00
2019-05-21 10:50:45 +02:00
2019-05-24 17:27:11 +02:00
2019-05-07 14:31:03 +02:00
2019-05-14 09:47:44 -07:00
2019-01-04 13:13:47 -08:00
2019-05-21 10:50:45 +02:00
2019-04-27 17:07:22 -04:00
2019-05-21 11:52:39 +02:00
2019-03-26 14:42:53 -07:00
2018-11-27 09:21:41 -08:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2018-11-07 23:51:16 -06:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2018-08-11 02:05:53 -05:00
2019-04-19 09:46:05 -07:00
2019-04-18 14:05:51 +02:00
2019-04-16 16:55:15 +02:00
2019-05-21 10:50:45 +02:00