1. 04 4月, 2019 1 次提交
    • G
      Input: evdev - use struct_size() in kzalloc() and vzalloc() · ecdf3a96
      Gustavo A. R. Silva 提交于
      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;
          struct boo entry[];
      };
      
      size = sizeof(struct foo) + count * sizeof(struct boo);
      instance = kzalloc(size, 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);
      
      Notice that, in this case, variable size is not necessary, hence
      it is removed.
      
      This code was detected with the help of Coccinelle.
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      ecdf3a96
  2. 04 3月, 2019 2 次提交
  3. 20 2月, 2019 1 次提交
  4. 19 2月, 2019 1 次提交
  5. 17 2月, 2019 9 次提交
  6. 10 2月, 2019 2 次提交
  7. 08 2月, 2019 3 次提交
  8. 07 2月, 2019 12 次提交
  9. 05 2月, 2019 2 次提交
  10. 29 1月, 2019 6 次提交
  11. 14 1月, 2019 1 次提交