All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] RDMA/restrack: Store all special QPs in restrack DB
@ 2020-11-26 11:33 Dan Carpenter
  2020-11-26 17:30 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-11-26 11:33 UTC (permalink / raw)
  To: leon; +Cc: linux-rdma

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] RDMA/restrack: Store all special QPs in restrack DB
  2020-11-26 11:33 [bug report] RDMA/restrack: Store all special QPs in restrack DB Dan Carpenter
@ 2020-11-26 17:30 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2020-11-26 17:30 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: leon, linux-rdma

On Thu, Nov 26, 2020 at 02:33:47PM +0300, Dan Carpenter wrote:

>    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.

I think we should ignore this one. I'm expecting the width of port to
increase..

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-26 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 11:33 [bug report] RDMA/restrack: Store all special QPs in restrack DB Dan Carpenter
2020-11-26 17:30 ` Jason Gunthorpe

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.