On 2/19/19 5:05 AM, Leon Romanovsky wrote:
From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
The error reported below is not possible in real life because
"requestor != NULL" means that "qp != NULL" too. However smatch
can't know it without extra help.
drivers/infiniband/hw/mlx5/odp.c:1254 mlx5_ib_mr_wqe_pfault_handler()
error: we previously assumed 'qp' could be null (see line 1230)
Fixes: 08100fad5cac ("IB/mlx5: Add ODP SRQ support")
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
drivers/infiniband/hw/mlx5/odp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index d828c20af38c..5e585cf5ee98 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -1259,7 +1259,7 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
}
wqe = buffer;
- if (requestor)
+ if (requestor && qp)
ret = mlx5_ib_mr_initiator_pfault_handler(dev, pfault, qp,
&wqe, &wqe_end,
bytes_copied);
This kind of change makes the code confusing to human readers. Have you
considered to add a BUG_ON(!qp) or WARN_ON(!qp) with a comment that
refers to sparse instead?
Thanks,
Bart.