Gustavo A. R. Silva
bbccc11bc8
audit: Use struct_size() helper in alloc_chunk
...
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 audit_chunk {
...
struct node {
struct list_head list;
struct audit_tree *owner;
unsigned index; /* index; upper bit indicates 'will prune' */
} owners[];
};
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:
offsetof(struct audit_chunk, owners) + count * sizeof(struct node);
with:
struct_size(chunk, owners, count)
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Signed-off-by: Paul Moore <paul@paul-moore.com >
2020-06-17 16:43:11 -04:00
..
2020-06-13 16:27:13 -07:00
2020-06-09 09:39:14 -07:00
2020-04-07 10:43:42 -07:00
2020-06-09 09:39:13 -07:00
2020-06-06 11:43:23 -07:00
2020-06-09 09:54:46 -07:00
2020-06-14 01:57:21 +09:00
2020-06-14 01:57:21 +09:00
2020-06-11 20:04:01 +02:00
2020-05-11 00:31:38 +02:00
2020-06-13 10:05:47 -07:00
2020-06-14 01:57:21 +09:00
2020-06-12 12:13:36 -07:00
2020-06-07 09:52:36 -07:00
2020-06-11 20:02:46 +02:00
2020-06-13 10:05:47 -07:00
2020-06-13 16:27:13 -07:00
2020-03-25 11:50:48 +01:00
2020-06-09 09:39:14 -07:00
2020-03-23 18:19:06 +01:00
2020-06-17 16:43:11 -04:00
2020-04-06 08:58:42 -07:00
2020-06-02 17:13:37 -07:00
2020-04-22 15:23:10 -04:00
2020-04-22 15:23:10 -04:00
2020-05-20 18:09:19 -04:00
2020-05-01 12:35:21 +10:00
2020-02-04 03:05:26 +00:00
2020-06-11 15:14:36 +02:00
2020-05-15 11:44:34 -07:00
2020-06-03 13:06:42 -07:00
2020-04-15 11:21:54 +02:00
2020-05-20 14:44:21 -05:00
2020-06-09 09:39:14 -07:00
2020-04-07 10:43:42 -07:00
2020-06-09 09:39:14 -07:00
2020-06-09 09:39:14 -07:00
2020-06-06 23:42:01 +09:00
2020-06-02 10:59:11 -07:00
2020-06-08 11:05:56 -07:00
2020-05-28 10:54:15 +02:00
2020-04-07 10:43:44 -07:00
2020-03-25 10:04:01 -05:00
2020-06-10 19:14:17 -07:00
2020-01-08 16:32:55 +00:00
2020-06-04 19:06:23 -07:00
2020-01-08 16:32:55 +00:00
2020-01-08 16:32:55 +00:00
2020-04-10 15:36:22 -07:00
2020-06-04 19:06:26 -07:00
2020-06-11 13:25:53 -07:00
2020-04-27 02:07:40 -04:00
2020-06-13 09:56:21 -07:00
2020-06-08 11:05:58 -07:00
2020-06-02 10:59:12 -07:00
2020-05-13 11:41:22 +02:00
2020-06-03 20:09:45 -07:00
2020-06-11 15:14:36 +02:00
2020-06-03 16:27:18 -07:00
2020-04-30 06:40:14 -05:00
2020-02-04 03:05:26 +00:00
2020-01-18 13:51:39 +01:00
2020-05-30 10:34:03 -07:00
2020-06-09 09:39:14 -07:00
2020-05-27 11:10:05 +02:00
2020-06-04 16:14:56 +01:00
2020-04-27 02:07:40 -04:00
2020-06-01 16:21:46 -07:00
2020-06-03 13:06:42 -07:00
2020-06-11 15:15:24 +02:00
2020-01-17 10:19:21 +01:00
2020-06-14 11:39:31 -07:00
2020-01-09 16:42:29 -07:00
2020-06-08 11:05:56 -07:00
2020-03-02 14:06:33 -07:00
2020-03-30 18:06:39 -07:00
2020-04-07 21:51:27 +02:00
2020-05-15 13:48:59 -07:00
2020-02-07 15:34:12 +01:00
2020-05-09 13:57:12 +02:00
2020-06-04 19:06:24 -07:00
2020-04-27 02:07:40 -04:00
2020-05-09 13:57:12 +02:00
2020-06-13 09:56:21 -07:00
2020-06-08 11:05:56 -07:00
2020-06-01 11:02:42 -04:00