[Intel-wired-lan] [next v2] iavf: use struct_size() helper
Bowers, AndrewX
andrewx.bowers at intel.com
Wed Jun 19 23:14:38 UTC 2019
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Jeff Kirsher
> Sent: Friday, June 14, 2019 4:23 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [next v2] iavf: use struct_size() helper
>
> From: "Gustavo A. R. Silva" <gustavo at embeddedor.com>
>
> 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 at embeddedor.com>
> ---
> v2: Fixed up patch to apply cleanly to the current iavf driver
>
> .../net/ethernet/intel/iavf/iavf_virtchnl.c | 37 ++++++++-----------
> 1 file changed, 16 insertions(+), 21 deletions(-)
Tested-by: Andrew Bowers <andrewx.bowers at intel.com>
More information about the Intel-wired-lan
mailing list