Kees Cook
b4b06db115
treewide: Use struct_size() for vmalloc()-family
This only finds one hit in the entire tree, but here's the Coccinelle:
// Directly refer to structure's field
@@
identifier alloc =~ "vmalloc|vzalloc";
identifier VAR, ELEMENT;
expression COUNT;
@@
- alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT))
+ alloc(struct_size(VAR, ELEMENT, COUNT))
// mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
@@
identifier alloc =~ "vmalloc|vzalloc";
identifier VAR, ELEMENT;
expression COUNT;
@@
- alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]))
+ alloc(struct_size(VAR, ELEMENT, COUNT))
// Same pattern, but can't trivially locate the trailing element name,
// or variable name.
@@
identifier alloc =~ "vmalloc|vzalloc";
expression SOMETHING, COUNT, ELEMENT;
@@
- alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT))
+ alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT))
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-06 11:15:43 -07:00
..
2018-04-26 11:06:36 -07:00
2018-04-26 10:35:04 +02:00
2018-04-23 12:12:41 +02:00
2018-04-03 17:42:25 -07:00
2018-04-19 13:41:49 -04:00
2018-06-05 12:16:51 -07:00
2018-04-25 21:05:15 -07:00
2018-04-01 21:43:02 +03:00
2018-04-26 16:53:23 +02:00
2018-04-18 08:21:32 -06:00
2018-04-26 16:36:11 -07:00
2018-06-06 11:15:43 -07:00
2018-04-19 13:21:35 +02:00
2018-04-30 10:14:08 +02:00
2018-04-09 11:54:57 +02:00
2018-04-07 19:04:02 +09:00
2018-06-06 11:15:43 -07:00
2018-06-06 11:15:43 -07:00
2018-04-05 14:21:13 -07:00
2018-04-04 20:07:20 -07:00
2018-06-06 11:15:43 -07:00
2018-04-16 10:15:58 +01:00
2018-03-27 09:51:22 +02:00
2018-04-23 13:27:05 +02:00
2018-06-06 11:15:43 -07:00
2018-06-06 11:15:43 -07:00
2018-04-19 09:25:15 +02:00
2018-04-09 11:42:31 -07:00
2018-04-25 05:31:06 -07:00
2018-06-06 11:15:43 -07:00
2018-04-04 20:07:20 -07:00
2018-04-27 14:12:43 +02:00
2018-04-05 14:27:02 -07:00
2018-04-05 09:51:41 -07:00
2018-06-06 11:15:43 -07:00
2018-06-06 11:15:43 -07:00
2018-05-03 16:36:07 +02:00
2018-05-02 15:56:10 +02:00
2018-04-12 21:46:10 -04:00
2018-03-29 17:29:09 -06:00
2018-04-07 12:08:19 -07:00
2018-06-06 11:15:43 -07:00
2018-05-04 06:21:06 -04:00
2018-04-18 10:07:13 -07:00
2018-04-18 23:37:25 -04:00
2018-04-10 22:25:07 -07:00
2018-06-06 11:15:43 -07:00
2018-04-20 10:41:31 -07:00
2018-04-26 19:06:42 +02:00
2018-06-06 11:15:43 -07:00
2018-04-19 15:10:56 -07:00
2018-05-04 20:51:10 -10:00
2018-04-04 20:07:20 -07:00
2018-04-23 10:06:59 +02:00
2018-03-29 15:07:48 -04:00
2018-05-02 21:47:35 +02:00
2018-04-04 20:07:20 -07:00
2018-04-26 16:28:24 -07:00
2018-04-09 09:26:36 -07:00
2018-04-05 21:29:35 -07:00
2018-04-05 21:21:08 -07:00
2018-04-05 09:51:41 -07:00
2018-05-04 22:20:14 +02:00
2018-04-05 21:21:08 -07:00
2018-04-13 15:46:21 -07:00
2018-04-20 17:18:35 -07:00
2018-03-28 10:33:53 +08:00
2018-04-25 16:46:55 -07:00
2018-06-06 11:15:43 -07:00
2018-04-25 16:46:55 -07:00
2018-04-25 13:24:13 +10:00
2018-06-06 11:15:43 -07:00
2018-04-30 16:06:01 -04:00
2018-04-20 19:23:32 -04:00
2018-04-23 13:40:15 +02:00
2018-04-16 15:15:23 -07:00
2018-04-03 12:06:21 -07:00
2018-06-06 11:15:43 -07:00
2018-04-20 19:24:01 -04:00
2018-04-13 14:11:53 +08:00
2018-04-25 15:03:44 +02:00
2018-04-23 12:43:48 +02:00
2018-06-06 11:15:43 -07:00
2018-04-06 19:44:27 -07:00
2018-04-11 10:54:06 -04:00
2018-04-10 10:20:00 -07:00
2018-04-23 13:41:55 +02:00
2018-04-11 18:58:27 -07:00
2018-04-16 10:22:40 +02:00
2018-04-20 08:36:04 -07:00
2018-06-06 11:15:43 -07:00
2018-03-29 13:38:10 +03:00