Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kliteyn@nvidia.com
Cc: Yevgeny Kliteynik <kliteyn@nvidia.com>, linux-rdma@vger.kernel.org
Subject: [bug report] net/mlx5: DR, Add STEv1 setters and getters
Date: Fri, 5 Feb 2021 16:02:54 +0300	[thread overview]
Message-ID: <YB1B/iHMlHHnOWCh@mwanda> (raw)

Hello Yevgeny Kliteynik,

The patch a6098129c781: "net/mlx5: DR, Add STEv1 setters and getters"
from Sep 22, 2020, leads to the following static checker warning:

	drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c:268 dr_ste_v1_get_miss_addr()
	warn: potential shift truncation.  '0xff (0-255) << 26'

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c
   264  static u64 dr_ste_v1_get_miss_addr(u8 *hw_ste_p)
   265  {
   266          u64 index =
   267                  (MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_31_6) |
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   268                   MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_39_32) << 26);
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

index is a u64 but the right side is a two u32s.  The << 26 can shift
wrap potentially according to Smatch.

   269  
   270          return index << 6;
   271  }

regards,
dan carpenter

             reply	other threads:[~2021-02-05 22:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 13:02 Dan Carpenter [this message]
2021-02-06 20:20 ` [bug report] net/mlx5: DR, Add STEv1 setters and getters Yevgeny Kliteynik

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=YB1B/iHMlHHnOWCh@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kliteyn@nvidia.com \
    --cc=linux-rdma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox