]> asedeno.scripts.mit.edu Git - linux.git/commit
iavf: use struct_size() helper
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Fri, 14 Jun 2019 23:23:20 +0000 (16:23 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 28 Jun 2019 22:59:48 +0000 (15:59 -0700)
commitaf07adbb1cfc207b9ad2bacd40332723a7833f4a
tree1ec9a8f58c759940028e2bbe7df8c9a77a4cab74
parent583cf7be751987005c70f4614e148eb5611f8060
iavf: use struct_size() helper

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes, in particular in the
context in which this code is being used.

So, replace code of the following form:

sizeof(struct virtchnl_ether_addr_list) + (count * sizeof(struct virtchnl_ether_addr))

with:

struct_size(veal, list, count)

and so on...

This code was detected with the help of Coccinelle.

Signed-off-by: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c