Gustavo A. R. Silva 725e0e15f8 rtc: sun6i: 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;
        void *entry[];
};

instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, 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);

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-08-27 23:02:18 +02:00
..
2018-07-26 15:08:53 +02:00
2018-08-20 16:30:27 -07:00
2018-04-10 10:22:27 -07:00
2018-05-21 22:34:38 +02:00
2018-03-27 10:45:05 +02:00
2018-05-17 22:23:14 +02:00
2018-03-17 14:20:56 +01:00
2018-05-03 22:08:00 +02:00
2018-05-03 22:08:00 +02:00
2018-05-03 22:08:00 +02:00
2017-09-01 01:10:11 +02:00
2017-09-01 01:10:11 +02:00
2016-05-20 12:33:51 +02:00
2018-03-17 14:20:50 +01:00
2018-05-03 22:08:00 +02:00
2018-05-18 09:38:22 +02:00
2018-03-17 14:20:56 +01:00
2018-05-03 22:08:00 +02:00
2018-05-22 09:47:17 +02:00
2018-05-03 22:08:00 +02:00
2017-08-22 12:05:21 +02:00
2018-06-07 20:11:08 +02:00
2016-05-20 12:33:51 +02:00
2017-09-05 09:55:02 +02:00
2018-05-17 22:43:22 +02:00
2018-08-20 16:30:27 -07:00
2018-05-23 09:26:19 +02:00
2018-05-03 22:08:00 +02:00
2018-07-12 20:16:10 +02:00
2018-05-17 22:37:11 +02:00
2018-05-17 22:54:21 +02:00
2016-05-20 12:33:51 +02:00
2018-05-03 22:08:00 +02:00