Gustavo A. R. Silva c2b8bd49d3 afs: 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);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2019-01-10 17:12:05 +00:00
..
2019-01-10 17:12:05 +00:00
2019-01-06 08:36:21 -05:00
2018-08-21 23:54:17 -04:00
2018-12-03 15:30:24 -06:00
\n
2018-12-27 17:00:35 -08:00
2019-01-06 12:19:23 -08:00
2018-12-31 09:41:37 -08:00
2018-12-27 17:12:30 -08:00
2018-11-30 14:56:14 -08:00
2018-08-17 16:20:28 -07:00
2018-09-29 22:47:48 -04:00
2019-01-02 16:35:23 -08:00
2018-05-22 14:27:52 -04:00
2019-01-02 16:35:23 -08:00
2018-11-05 14:57:05 -05:00
2018-05-22 14:27:52 -04:00
\n
2018-12-27 17:00:35 -08:00
2018-07-03 16:44:45 -04:00
2018-10-29 14:29:58 -07:00
2018-06-05 19:23:26 +02:00
2018-12-31 09:46:39 -08:00
2018-10-31 08:54:16 -07:00
2018-12-04 09:38:05 -07:00
2018-12-28 20:54:57 -08:00
2018-10-21 10:46:42 -04:00
2018-12-28 12:45:04 -08:00
2018-08-21 18:19:09 -07:00
2018-06-11 08:22:34 -07:00
2018-02-15 15:34:42 -05:00
2018-08-21 18:19:09 -07:00
2018-04-04 12:44:02 -07:00