RDMA/restrack: Store all special QPs in restrack DB
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
Quoted 7 lines · Dan Carpenter
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->portis 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