lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250913101933.GW341237@unreal>
Date: Sat, 13 Sep 2025 13:19:33 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Alex Mastro <amastro@...com>
Cc: Alex Williamson <alex.williamson@...hat.com>,
	Jason Gunthorpe <jgg@...dia.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Christian König <christian.koenig@....com>,
	Christoph Hellwig <hch@....de>, dri-devel@...ts.freedesktop.org,
	iommu@...ts.linux.dev, Jens Axboe <axboe@...nel.dk>,
	Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
	linaro-mm-sig@...ts.linaro.org, linux-block@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
	linux-mm@...ck.org, linux-pci@...r.kernel.org,
	Logan Gunthorpe <logang@...tatee.com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Robin Murphy <robin.murphy@....com>,
	Sumit Semwal <sumit.semwal@...aro.org>,
	Vivek Kasireddy <vivek.kasireddy@...el.com>,
	Will Deacon <will@...nel.org>
Subject: Re: [PATCH v1 10/10] vfio/pci: Add dma-buf export support for MMIO
 regions

On Fri, Sep 12, 2025 at 11:55:29AM -0700, Alex Mastro wrote:
> On Mon, Aug 04, 2025 at 04:00:45PM +0300, Leon Romanovsky wrote:
> > +static void dma_ranges_to_p2p_phys(struct vfio_pci_dma_buf *priv,
> > +				   struct vfio_device_feature_dma_buf *dma_buf,
> > +				   struct vfio_region_dma_range *dma_ranges)
> > +{
> > +	struct pci_dev *pdev = priv->vdev->pdev;
> > +	phys_addr_t pci_start;
> > +	int i;
> > +
> > +	pci_start = pci_resource_start(pdev, dma_buf->region_index);
> > +	for (i = 0; i < dma_buf->nr_ranges; i++) {
> > +		priv->phys_vec[i].len = dma_ranges[i].length;
> > +		priv->phys_vec[i].paddr += pci_start + dma_ranges[i].offset;
> 
> Is the intent really to += paddr? I would have expected a plain assignment.

In this specific case, there is no difference, because phys_vec is
initialized to 0, but It needs to be "=" and not "+=".

> 
> > +		priv->size += priv->phys_vec[i].len;
> > +	}
> > +	priv->nr_ranges = dma_buf->nr_ranges;
> > +}
> 
> ...
> 
> > +	priv->phys_vec = kcalloc(get_dma_buf.nr_ranges, sizeof(*priv->phys_vec),
> > +				 GFP_KERNEL);
> > +	if (!priv->phys_vec) {
> > +		ret = -ENOMEM;
> > +		goto err_free_priv;
> > +	}
> > +
> > +	priv->vdev = vdev;
> > +	dma_ranges_to_p2p_phys(priv, &get_dma_buf, dma_ranges);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ