From: Jason Gunthorpe <jgg@nvidia.com>
To: Wenpeng Liang <liangwenpeng@huawei.com>
Cc: dledford@redhat.com, linux-rdma@vger.kernel.org, linuxarm@huawei.com
Subject: Re: [PATCH v3 for-next] RDMA/hns: Add a new mmap implementation
Date: Wed, 27 Oct 2021 09:09:41 -0300 [thread overview]
Message-ID: <20211027120941.GA583629@nvidia.com> (raw)
In-Reply-To: <20211027104129.36902-1-liangwenpeng@huawei.com>
On Wed, Oct 27, 2021 at 06:41:29PM +0800, Wenpeng Liang wrote:
> +static int hns_roce_alloc_uar_entry(struct ib_ucontext *uctx)
> +{
> + struct hns_roce_ucontext *context = to_hr_ucontext(uctx);
> + struct hns_roce_dev *hr_dev = to_hr_dev(uctx->device);
> + u64 address;
> + int ret;
> +
> + address = context->uar.pfn << PAGE_SHIFT;
> + context->db_mmap_entry =
> + hns_roce_user_mmap_entry_insert(uctx, address, PAGE_SIZE,
> + HNS_ROCE_MMAP_TYPE_DB);
> + if (!context->db_mmap_entry)
> + return -ENOMEM;
> +
> + if (!hr_dev->tptr_dma_addr || !hr_dev->tptr_size)
> + return 0;
You can move the FIXME comment below to here
> + context->tptr_mmap_entry =
> + hns_roce_user_mmap_entry_insert(uctx, hr_dev->tptr_dma_addr,
> + hr_dev->tptr_size,
> + HNS_ROCE_MMAP_TYPE_TPTR);
> + if (!context->tptr_mmap_entry) {
> + ret = -ENOMEM;
> + goto err;
> + }
> +
> + return 0;
> +
> +err:
> + hns_roce_dealloc_uar_entry(context);
> + return ret;
> +}
> + rdma_entry = rdma_user_mmap_entry_get_pgoff(uctx, vma->vm_pgoff);
> + if (!rdma_entry) {
> + ibdev_err(ibdev, "Invalid entry vm_pgoff %lu.\n",
> + vma->vm_pgoff);
Do not print on user controlled paths
Jason
next prev parent reply other threads:[~2021-10-27 12:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 10:41 [PATCH v3 for-next] RDMA/hns: Add a new mmap implementation Wenpeng Liang
2021-10-27 12:09 ` Jason Gunthorpe [this message]
2021-10-28 8:45 ` Wenpeng Liang
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=20211027120941.GA583629@nvidia.com \
--to=jgg@nvidia.com \
--cc=dledford@redhat.com \
--cc=liangwenpeng@huawei.com \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.