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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200905181028.01914.arnd@arndb.de>
Date:	Mon, 18 May 2009 10:28:00 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Jeff Garzik <jgarzik@...ox.com>,
	Robert Hancock <hancockrwd@...il.com>,
	Tejun Heo <htejun@...il.com>,
	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	alan@...rguk.ukuu.org.uk, flar@...andria.com,
	schmitz@...phys.uni-duesseldorf.de, linux-kernel@...r.kernel.org,
	linux-ide@...r.kernel.org, takata@...ux-m32r.org,
	linux-m68k@...r.kernel.org, ysato@...rs.sourceforge.jp
Subject: Re: [PATCH] asm-generic: add a dma-mapping.h file

On Monday 18 May 2009, Geert Uytterhoeven wrote:

> > +#ifndef dma_alloc_coherent
> > +static inline void *
> > +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
> > +                  gfp_t flag)
> > +{
> > +       void *virt = kmalloc(size, flag);
> 
> kmalloc() may fail.
> 
> > +       *dma_handle = virt_to_phys(virt);
> 
> Not all variants of virt_to_phys() may handle the NULL case very well.
> I took a statistically invalid sample: some just cast to unsigned
> long, other subtract PAGE_OFFSET.

Right. It should not really hurt, because all users need to check virt
before using dma_handle, but I can fix it just to be sure.

I'll wait for comments from Fujita Tomonori and others before I repost.

	Arnd <><
--
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