Searched hist:"27429 be7" (Results 1 – 1 of 1) sorted by relevance
/openbmc/linux/drivers/net/ethernet/intel/fm10k/ |
H A D | fm10k_main.c | 27429be7 Mon Jul 08 18:12:33 CDT 2019 Jacob Keller <jacob.e.keller@intel.com> fm10k: cast page_addr to u8 * when incrementing it
The page_addr variable is a void pointer. Incrementing it before calling prefetch is technically undefined. Fix this by casting it to a u8* pointer before incrementing it. This ensures that we increment the pointer value in byte units, instead of relying on this undefined behavior.
This was detected by cppcheck, and resolves the following warning produced by that tool:
[fm10k_main.c:328]: (portability) 'page_addr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> 27429be7 Mon Jul 08 18:12:33 CDT 2019 Jacob Keller <jacob.e.keller@intel.com> fm10k: cast page_addr to u8 * when incrementing it The page_addr variable is a void pointer. Incrementing it before calling prefetch is technically undefined. Fix this by casting it to a u8* pointer before incrementing it. This ensures that we increment the pointer value in byte units, instead of relying on this undefined behavior. This was detected by cppcheck, and resolves the following warning produced by that tool: [fm10k_main.c:328]: (portability) 'page_addr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
|