From: Jacob Keller <jacob.e.keller@intel.com>
To: Nikolay Kuratov <kniv@yandex-team.ru>, <linux-kernel@vger.kernel.org>
Cc: <netdev@vger.kernel.org>, <stable@vger.kernel.org>,
<lvc-project@linuxtesting.org>,
Kumar Sanghvi <kumaras@chelsio.com>,
"Potnuri Bharat Teja" <bharat@chelsio.com>,
Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,
Ganesh Goudar <ganeshgr@chelsio.com>,
"David S. Miller" <davem@davemloft.net>,
Simon Horman <horms@kernel.org>
Subject: Re: [PATCH v2] cxgb4: add forgotten u64 ivlan cast before shift
Date: Tue, 20 Aug 2024 14:41:36 -0700 [thread overview]
Message-ID: <88140d00-9575-40bb-b600-9bde91f4e854@intel.com> (raw)
In-Reply-To: <20240819075408.92378-1-kniv@yandex-team.ru>
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@intel.com>
> Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
> Cc: stable@vger.kernel.org
> Fixes: 12b276fbf6e0 ("cxgb4: add support to create hash filters")
> Reviewed-by: Simon Horman <horms@kernel.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;
next prev parent reply other threads:[~2024-08-20 21:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 7:54 [PATCH v2] cxgb4: add forgotten u64 ivlan cast before shift Nikolay Kuratov
2024-08-20 21:41 ` Jacob Keller [this message]
2024-08-20 22:44 ` Jakub Kicinski
2024-08-20 22:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=88140d00-9575-40bb-b600-9bde91f4e854@intel.com \
--to=jacob.e.keller@intel.com \
--cc=bharat@chelsio.com \
--cc=davem@davemloft.net \
--cc=ganeshgr@chelsio.com \
--cc=horms@kernel.org \
--cc=kniv@yandex-team.ru \
--cc=kumaras@chelsio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=rahul.lakkireddy@chelsio.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.