All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: leon@kernel.org
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] RDMA/restrack: Store all special QPs in restrack DB
Date: Thu, 26 Nov 2020 14:33:47 +0300	[thread overview]
Message-ID: <20201126113347.GA128957@mwanda> (raw)

Hello Leon Romanovsky,

The patch 0413755c95e7: "RDMA/restrack: Store all special QPs in
restrack DB" from Nov 4, 2020, leads to the following static checker
warning:

	drivers/infiniband/core/restrack.c:235 rdma_restrack_add()
	warn: right shifting more than type allows 8 vs 8

drivers/infiniband/core/restrack.c
   220  void rdma_restrack_add(struct rdma_restrack_entry *res)
   221  {
   222          struct ib_device *dev = res_to_dev(res);
   223          struct rdma_restrack_root *rt;
   224          int ret;
   225  
   226          if (!dev)
   227                  return;
   228  
   229          rt = &dev->res[res->type];
   230  
   231          if (res->type == RDMA_RESTRACK_QP) {
   232                  /* Special case to ensure that LQPN points to right QP */
   233                  struct ib_qp *qp = container_of(res, struct ib_qp, res);
   234  
   235                  WARN_ONCE(qp->qp_num >> 24 || qp->port >> 8,
                                                      ^^^^^^^^^^^^^
qp->port is a u8 so this is always going to be zero.

   236                            "QP number 0x%0X and port 0x%0X", qp->qp_num,
   237                            qp->port);
   238                  res->id = qp->qp_num;
   239                  if (qp->qp_type == IB_QPT_SMI || qp->qp_type == IB_QPT_GSI)
   240                          res->id |= qp->port << 24;
   241                  ret = xa_insert(&rt->xa, res->id, res, GFP_KERNEL);
   242                  if (ret)
   243                          res->id = 0;
   244          } else if (res->type == RDMA_RESTRACK_COUNTER) {
   245                  /* Special case to ensure that cntn points to right counter */

regards,
dan carpenter

             reply	other threads:[~2020-11-26 11:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 11:33 Dan Carpenter [this message]
2020-11-26 17:30 ` [bug report] RDMA/restrack: Store all special QPs in restrack DB Jason Gunthorpe

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=20201126113347.GA128957@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=leon@kernel.org \
    --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 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.