lkml.org 
[lkml]   [2022]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [Intel-wired-lan] [PATCH v2 net-next 1/4] ice: switch: add and use u16[] aliases to ice_adv_lkup_elem::{h, m}_u
Date
>-----Original Message-----
>From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
>Alexander Lobakin
>Sent: Thursday, January 27, 2022 9:10 PM
>To: intel-wired-lan@lists.osuosl.org
>Cc: Szapar-Mudlaw, Martyna <martyna.szapar-mudlaw@intel.com>;
>netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Jakub Kicinski
><kuba@kernel.org>; David S. Miller <davem@davemloft.net>
>Subject: [Intel-wired-lan] [PATCH v2 net-next 1/4] ice: switch: add and use
>u16[] aliases to ice_adv_lkup_elem::{h, m}_u
>
>ice_adv_lkup_elem fields h_u and m_u are being accessed as raw u16 arrays
>in several places.
>To reduce cast and braces burden, add permanent array-of-u16 aliases with
>the same size as the `union ice_prot_hdr` itself via anonymous unions to the
>actual struct declaration, and just access them directly.
>
>This:
> - removes the need to cast the union to u16[] and then dereference
> it each time -> reduces the horizon for potential bugs;
> - improves -Warray-bounds coverage -- the array size is now known
> at compilation time;
> - addresses cppcheck complaints.
>
>Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
>---
> drivers/net/ethernet/intel/ice/ice_switch.c | 15 +++++++--------
>drivers/net/ethernet/intel/ice/ice_switch.h | 12 ++++++++++--
> 2 files changed, 17 insertions(+), 10 deletions(-)
>
Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com>

\
 
 \ /
  Last update: 2022-02-18 06:19    [W:0.061 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site