From: Zhu Yanjun <yanjun.zhu@intel.com>
To: yanjun.zhu@intel.com, zyjzyj2000@gmail.com, jgg@ziepe.ca,
leon@kernel.org, linux-rdma@vger.kernel.org
Cc: Zhu Yanjun <yanjun.zhu@linux.dev>
Subject: [for-next PATCH 1/1] RDMA/rxe: sgt_append from ib_umem_get is not highmem
Date: Sat, 19 Nov 2022 20:29:38 -0500 [thread overview]
Message-ID: <20221120012939.539953-1-yanjun.zhu@intel.com> (raw)
In-Reply-To: <c806a812-4ecd-226f-109e-84642357fbcb@linux.dev>
From: Zhu Yanjun <yanjun.zhu@linux.dev>
In ib_umem_get, sgt_append is allocated from the function
sg_alloc_append_table_from_pages. And it is not from highmem.
As such, the return value of page_address will not be NULL.
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
drivers/infiniband/sw/rxe/rxe_mr.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
index b1423000e4bc..3f33a4cdef24 100644
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@ -119,7 +119,6 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
struct ib_umem *umem;
struct sg_page_iter sg_iter;
int num_buf;
- void *vaddr;
int err;
umem = ib_umem_get(&rxe->ib_dev, start, length, access);
@@ -149,6 +148,8 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
buf = map[0]->buf;
for_each_sgtable_page (&umem->sgt_append.sgt, &sg_iter, 0) {
+ void *vaddr;
+
if (num_buf >= RXE_BUF_PER_MAP) {
map++;
buf = map[0]->buf;
@@ -156,16 +157,10 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
}
vaddr = page_address(sg_page_iter_page(&sg_iter));
- if (!vaddr) {
- rxe_dbg_mr(mr, "Unable to get virtual address\n");
- err = -ENOMEM;
- goto err_release_umem;
- }
buf->addr = (uintptr_t)vaddr;
buf->size = PAGE_SIZE;
num_buf++;
buf++;
-
}
}
--
2.27.0
next prev parent reply other threads:[~2022-11-19 9:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-30 3:04 [PATCH for-next v2] RDMA/rxe: Fix mr->map double free Li Zhijian
2022-11-12 3:29 ` lizhijian
2022-11-13 12:40 ` Yanjun Zhu
2022-11-16 0:10 ` Yanjun Zhu
2022-11-16 2:39 ` lizhijian
2022-11-19 0:15 ` Jason Gunthorpe
2022-11-19 8:25 ` Yanjun Zhu
2022-11-20 1:29 ` Zhu Yanjun [this message]
2022-11-19 10:30 ` [for-next PATCH 1/1] RDMA/rxe: sgt_append from ib_umem_get is not highmem lizhijian
2022-11-19 13:20 ` Yanjun Zhu
2022-11-21 15:28 ` Jason Gunthorpe
2022-11-22 4:07 ` Yanjun Zhu
2022-11-22 14:06 ` Jason Gunthorpe
2022-11-23 1:53 ` Yanjun Zhu
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=20221120012939.539953-1-yanjun.zhu@intel.com \
--to=yanjun.zhu@intel.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=yanjun.zhu@linux.dev \
--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