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-next>] [day] [month] [year] [list]
Message-ID: <50AFA24D.4030501@imgtec.com>
Date:	Fri, 23 Nov 2012 16:20:29 +0000
From:	James Hogan <james.hogan@...tec.com>
To:	Arnd Bergmann <arnd@...db.de>
CC:	<linux-arch@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v1 24/40] metag: DMA

On 23/11/12 15:53, James Hogan wrote:
> On 09/11/12 14:25, Arnd Bergmann wrote:
>> On Wednesday 31 October 2012, James Hogan wrote:
>>> +static inline void
>>> +dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
>>> +                enum dma_data_direction direction)
>>> +{
>>> +       BUG_ON(!valid_dma_direction(direction));
>>> +       dma_sync_for_cpu((void *)bus_to_virt(dma_addr), size, direction);
>>> +}
>>
>> bus_to_virt is deprecated an should not be visible to device drivers
>> any more for new stuff. Maybe you can remove the definition and introduce
>> a __bus_to_virt() function for internal use that also returns a pointer
>> type instead.
> 
> Hi Arnd,
> 
> Is there any reason not to just directly use phys_to_virt (which
> bus_to_virt was defined as before)?
> 
> Thanks
> James
> 

asm-generic/io.h has bitten me. Does the following look reasonable?

Thanks
James

Subject: [PATCH 1/1] asm-generic/io.h: check CONFIG_VIRT_TO_BUS

Make asm-generic/io.h check CONFIG_VIRT_TO_BUS before defining
virt_to_bus() and bus_to_virt(), otherwise it's easy to accidentally
have a silently failing incorrect direct mapped definition rather then
no definition at all.

Signed-off-by: James Hogan <james.hogan@...tec.com>
---
 include/asm-generic/io.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 616eea5..34823ef 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -350,6 +350,7 @@ extern void ioport_unmap(void __iomem *p);
 #define xlate_dev_kmem_ptr(p)	p
 #define xlate_dev_mem_ptr(p)	__va(p)
 
+#ifdef CONFIG_VIRT_TO_BUS
 #ifndef virt_to_bus
 static inline unsigned long virt_to_bus(volatile void *address)
 {
@@ -361,6 +362,7 @@ static inline void *bus_to_virt(unsigned long address)
 	return (void *) address;
 }
 #endif
+#endif
 
 #define memset_io(a, b, c)	memset(__io_virt(a), (b), (c))
 #define memcpy_fromio(a, b, c)	memcpy((a), __io_virt(b), (c))
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ