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