Files
linux/fs/ocfs2
Gustavo A. R. Silva f402cf03fc ocfs2: Use zero-sized array and struct_size() in kzalloc()
Update the code to use a zero-sized array instead of a pointer in
structure ocfs2_slot_info and use struct_size() in kzalloc().

Notice that 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.

Link: http://lkml.kernel.org/r/20190108191903.GA22056@embeddedor
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Junxiao Bi <[email protected]>
Cc: Joseph Qi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2019-03-05 21:07:13 -08:00
..
2018-12-28 12:11:45 -08:00
2017-09-06 17:27:24 -07:00
2019-01-04 13:13:48 -08:00
…
…
…
2018-11-30 14:56:15 -08:00
…
2018-01-31 17:18:35 -08:00
2018-01-31 17:18:35 -08:00
2018-08-17 16:20:27 -07:00
2018-06-07 17:34:33 -07:00
…
…
…
2018-12-28 12:11:45 -08:00
…
…
…
…
2018-06-12 16:19:22 -07:00
…
2016-05-12 15:52:50 -07:00