Re: [PATCH v2 13/22] iommufd: Add mmap interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 29, 2025 at 08:34:56PM +0000, Pranjal Shrivastava wrote:
> On Tue, Apr 29, 2025 at 08:24:33PM +0000, Pranjal Shrivastava wrote:
> > On Fri, Apr 25, 2025 at 10:58:08PM -0700, Nicolin Chen wrote:
> > > +	struct iommufd_mmap *immap;
> > > +	int rc;
> > > +
> > > +	if (WARN_ON_ONCE(!immap_id))
> > > +		return -EINVAL;
> > > +	if (base & ~PAGE_MASK)
> > > +		return -EINVAL;
> > > +	if (!size || size & ~PAGE_MASK)
> > > +		return -EINVAL;
> > > +
> > > +	immap = kzalloc(sizeof(*immap), GFP_KERNEL);
> > > +	if (!immap)
> > > +		return -ENOMEM;
> > > +	immap->pfn_start = base >> PAGE_SHIFT;
> > > +	immap->pfn_end = immap->pfn_start + (size >> PAGE_SHIFT) - 1;
> > > +
> > > +	rc = mtree_alloc_range(&ictx->mt_mmap, immap_id, immap, sizeof(immap),
> > 
> > I believe this should be sizeof(*immap) ?
> 
> Ugh, Sorry, shouldn't this be size >> PAGE_SHIFT (num_indices to alloc) ?

mtree_load() returns a "struct iommufd_map *" pointer.

Nicolin




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux