From: "yanjun.zhu" <yanjun.zhu@linux.dev>
To: Dan Carpenter <dan.carpenter@linaro.org>,
Zhu Yanjun <zyjzyj2000@gmail.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
Daisuke Matsuda <dskmtsd@gmail.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] RDMA/rxe: Fix a couple IS_ERR() vs NULL bugs
Date: Wed, 25 Jun 2025 11:03:49 -0700 [thread overview]
Message-ID: <d72af2c1-2faf-46db-b212-0b800040c311@linux.dev> (raw)
In-Reply-To: <685c1430.050a0220.18b0ef.da83@mx.google.com>
On 6/25/25 8:22 AM, Dan Carpenter wrote:
> The lookup_mr() function returns NULL on error. It never returns error
> pointers.
Yes, I agree with you. However, this commit is intended to fix an issue
in the rdma-next tree. The corresponding repository is:
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git.
Therefore, the subject should be: [PATCH rdma-next]
This problem does not exist in the upstream Linux kernel.
Other than that, I have no issues with the commit.
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Zhu Yanjun
>
> Fixes: 9284bc34c773 ("RDMA/rxe: Enable asynchronous prefetch for ODP MRs")
> Fixes: 3576b0df1588 ("RDMA/rxe: Implement synchronous prefetch for ODP MRs")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/infiniband/sw/rxe/rxe_odp.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_odp.c b/drivers/infiniband/sw/rxe/rxe_odp.c
> index 01a59d3f8ed4..f58e3ec6252f 100644
> --- a/drivers/infiniband/sw/rxe/rxe_odp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_odp.c
> @@ -470,10 +470,10 @@ static int rxe_ib_prefetch_sg_list(struct ib_pd *ibpd,
> mr = lookup_mr(pd, IB_ACCESS_LOCAL_WRITE,
> sg_list[i].lkey, RXE_LOOKUP_LOCAL);
>
> - if (IS_ERR(mr)) {
> + if (!mr) {
> rxe_dbg_pd(pd, "mr with lkey %x not found\n",
> sg_list[i].lkey);
> - return PTR_ERR(mr);
> + return -EINVAL;
> }
>
> if (advice == IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE &&
> @@ -535,8 +535,10 @@ static int rxe_ib_advise_mr_prefetch(struct ib_pd *ibpd,
> /* Takes a reference, which will be released in the queued work */
> mr = lookup_mr(pd, IB_ACCESS_LOCAL_WRITE,
> sg_list[i].lkey, RXE_LOOKUP_LOCAL);
> - if (IS_ERR(mr))
> + if (!mr) {
> + mr = ERR_PTR(-EINVAL);
> goto err;
> + }
>
> work->frags[i].io_virt = sg_list[i].addr;
> work->frags[i].length = sg_list[i].length;
next prev parent reply other threads:[~2025-06-25 18:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 15:22 [PATCH] RDMA/rxe: Fix a couple IS_ERR() vs NULL bugs Dan Carpenter
2025-06-25 18:03 ` yanjun.zhu [this message]
2025-06-25 18:16 ` Dan Carpenter
2025-06-26 12:14 ` Leon Romanovsky
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=d72af2c1-2faf-46db-b212-0b800040c311@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=dan.carpenter@linaro.org \
--cc=dskmtsd@gmail.com \
--cc=jgg@ziepe.ca \
--cc=kernel-janitors@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=zyjzyj2000@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox