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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160519112122.GN29375@bigcity.dyn.berto.se>
Date:	Thu, 19 May 2016 13:21:22 +0200
From:	"Niklas Söderlund" <niklas.soderlund@...natech.se>
To:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc:	vinod.koul@...el.com, linux-renesas-soc@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	dmaengine@...r.kernel.org, iommu@...ts.linux-foundation.org,
	hch@...radead.org, linux-arch@...r.kernel.org,
	geert+renesas@...der.be, arnd@...db.de, linus.walleij@...aro.org,
	laurent.pinchart@...asonboard.com, dan.j.williams@...el.com
Subject: Re: [PATCHv6 2/8] dma-debug: add support for resource mappings

Hi Konrad,

Thanks for your feedback.

On 2016-05-17 10:50:02 -0400, Konrad Rzeszutek Wilk wrote:
> > +void debug_dma_map_resource(struct device *dev, phys_addr_t addr, size_t size,
> > +			    int direction, dma_addr_t dma_addr)
> > +{
> > +	struct dma_debug_entry *entry;
> > +
> > +	if (unlikely(dma_debug_disabled()))
> > +		return;
> > +
> > +	entry = dma_entry_alloc();
> > +	if (!entry)
> > +		return;
> > +
> > +	entry->type		= dma_debug_resource;
> > +	entry->dev		= dev;
> > +	entry->pfn		= __phys_to_pfn(addr);
> > +	entry->offset		= addr - PHYS_PFN(entry->pfn);
> 
> Is that right? 

You are correct that should be:

   entry->offset = addr - PFN_PHYS(entry->pfn);

Or even better:

   entry->offset = addr - __pfn_to_phys(entry->pfn);

I will address this and resend late next week, still hoping for some 
more feedback.

> 
> __phys_to_pfn(addr) is PHYS_PFN(addr), so what you get here is
> 
> addr - PHYS_PFN(PHYS_PFN(addr)) ?
> 
> 
> > +	entry->size		= size;
> > +	entry->dev_addr		= dma_addr;
> > +	entry->direction	= direction;
> > +	entry->map_err_type	= MAP_ERR_NOT_CHECKED;
> > +
> > +	add_dma_entry(entry);
> > +}
> > +EXPORT_SYMBOL(debug_dma_map_resource);
> > +

-- 
Regards,
Niklas Söderlund

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ