[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <88140d00-9575-40bb-b600-9bde91f4e854@intel.com>
Date: Tue, 20 Aug 2024 14:41:36 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Nikolay Kuratov <kniv@...dex-team.ru>, <linux-kernel@...r.kernel.org>
CC: <netdev@...r.kernel.org>, <stable@...r.kernel.org>,
<lvc-project@...uxtesting.org>, Kumar Sanghvi <kumaras@...lsio.com>, "Potnuri
Bharat Teja" <bharat@...lsio.com>, Rahul Lakkireddy
<rahul.lakkireddy@...lsio.com>, Ganesh Goudar <ganeshgr@...lsio.com>, "David
S. Miller" <davem@...emloft.net>, Simon Horman <horms@...nel.org>
Subject: Re: [PATCH v2] cxgb4: add forgotten u64 ivlan cast before shift
On 8/19/2024 12:54 AM, Nikolay Kuratov wrote:
> It is done everywhere in cxgb4 code, e.g. in is_filter_exact_match()
> There is no reason it should not be done here
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE
>
Without casting to u64, the value would be smaller and the shift might
not behave as expected?
Slightly annoying that the extra cause causes us to break 80 columns.
I checked and the FT_VLAN_VLD_F doesn't appear to already be a ULL value
either.
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
> Signed-off-by: Nikolay Kuratov <kniv@...dex-team.ru>
> Cc: stable@...r.kernel.org
> Fixes: 12b276fbf6e0 ("cxgb4: add support to create hash filters")
> Reviewed-by: Simon Horman <horms@...nel.org>
> ---
> v2: Wrap line to 80 characters
>
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
> index 786ceae34488..dd9e68465e69 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
> @@ -1244,7 +1244,8 @@ static u64 hash_filter_ntuple(struct ch_filter_specification *fs,
> * in the Compressed Filter Tuple.
> */
> if (tp->vlan_shift >= 0 && fs->mask.ivlan)
> - ntuple |= (FT_VLAN_VLD_F | fs->val.ivlan) << tp->vlan_shift;
> + ntuple |= (u64)(FT_VLAN_VLD_F |
> + fs->val.ivlan) << tp->vlan_shift;
>
> if (tp->port_shift >= 0 && fs->mask.iport)
> ntuple |= (u64)fs->val.iport << tp->port_shift;
Powered by blists - more mailing lists