linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wenpeng Liang <liangwenpeng@huawei.com>
To: Jason Gunthorpe <jgg@nvidia.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: Thu, 28 Oct 2021 16:45:40 +0800	[thread overview]
Message-ID: <c69b0bce-3537-9747-23f7-8d9c168ef92a@huawei.com> (raw)
In-Reply-To: <20211027120941.GA583629@nvidia.com>

On 2021/10/27 20:09, Jason Gunthorpe wrote:
> 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
> 

Thanks, I will move it in v4.

>> +	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
> .
> 

Thanks, I will remove it in v4.

Wenpeng

      reply	other threads:[~2021-10-28  8:45 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
2021-10-28  8:45   ` Wenpeng Liang [this message]

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=c69b0bce-3537-9747-23f7-8d9c168ef92a@huawei.com \
    --to=liangwenpeng@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).