Re: [bug report] IB/mlx5: Add ODP SRQ support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 19, 2019 at 12:51:53PM +0300, Dan Carpenter wrote:
> Hello Moni Shoua,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 08100fad5cac: "IB/mlx5: Add ODP SRQ support" from Jan 22,
> 2019, leads to the following Smatch complaint:
>
>     drivers/infiniband/hw/mlx5/odp.c:1254 mlx5_ib_mr_wqe_pfault_handler()
>     error: we previously assumed 'qp' could be null (see line 1230)

requestor != NULL means that qp != NULL too, but tools can't know about it.

I will write "if (requestor && qp) ...."

Thanks

>
> drivers/infiniband/hw/mlx5/odp.c
>   1229
>   1230		if (qp) {
>                     ^^
> New NULL check here.
>
>   1231			if (requestor) {
>   1232				ret = mlx5_ib_read_user_wqe_sq(qp, wqe_index,
>   1233						buffer, PAGE_SIZE,
>   1234						&bytes_copied);
>   1235			} else {
>   1236				ret = mlx5_ib_read_user_wqe_rq(qp, wqe_index,
>   1237						buffer, PAGE_SIZE,
>   1238						&bytes_copied);
>   1239			}
>   1240		} else {
>   1241			ret = mlx5_ib_read_user_wqe_srq(srq, wqe_index,
>   1242							buffer, PAGE_SIZE,
>   1243							&bytes_copied);
>   1244		}
>   1245
>   1246		if (ret) {
>   1247			mlx5_ib_err(dev, "Failed reading a WQE following page fault, error=%d, wqe_index=%x, qpn=%x\n",
>   1248				    ret, wqe_index, pfault->token);
>   1249			goto resolve_page_fault;
>   1250		}
>   1251
>   1252		wqe = buffer;
>   1253		if (requestor)
>   1254			ret = mlx5_ib_mr_initiator_pfault_handler(dev, pfault, qp,
>                                                                                ^^
> Unchecked dereference inside the function.
>
>   1255								  &wqe,  &wqe_end,
>   1256								  bytes_copied);
>
> regards,
> dan carpenter

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux