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] [day] [month] [year] [list]
Date:	Sat, 10 Feb 2007 20:56:52 +0100
From:	Ulrich Kunitz <kune@...ne-taler.de>
To:	Joe Perches <joe@...ches.com>
Cc:	Michael Buesch <mb@...sch.de>, Daniel Drake <dsd@...too.org>,
	linville@...driver.com, netdev@...r.kernel.org,
	linux-wireless@...r.kernel.org, rpjday@...dspring.com
Subject: Re: [PATCH] zd1211rw: Readd zd_addr_t cast

On 07-02-10 10:51 Joe Perches wrote:

> On Sat, 2007-02-10 at 07:02 +0100, Michael Buesch wrote:
> > On Saturday 10 February 2007 02:27, Daniel Drake wrote:
> > > Robert P.J. Day's recent commit ("getting rid of all casts of k[cmz]alloc()
> > > calls") introduced a sparse warning for zd1211rw, related to our type-checking
> > > of addresses.
> > > > 	zd_chip.c:116:15: warning: implicit cast to nocast type
> > > This patch readds the type cast, it is correct.
> > > Signed-off-by: Daniel Drake <dsd@...too.org>
> > > Index: linux/drivers/net/wireless/zd1211rw/zd_chip.c
> > > ===================================================================
> > > --- linux.orig/drivers/net/wireless/zd1211rw/zd_chip.c
> > > +++ linux/drivers/net/wireless/zd1211rw/zd_chip.c
> > > @@ -113,7 +113,7 @@ int zd_ioread32v_locked(struct zd_chip *
> > >  
> > >  	/* Allocate a single memory block for values and addresses. */
> > >  	count16 = 2*count;
> > > -	a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
> > > +	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
> > >  		                   GFP_NOFS);
> 
> I think it better to remove this __nocast instead.
> This is the only use of __nocast outside of kmem in the kernel tree.
> 
> Why not just remove __nocast and use u16 instead of zd_addr_t?

Using the __nocast type sparse catches errors, when address and
value arguments are used in the wrong order for calls of the
zd_ioread* and zd_iowrite* functions. I'm a lazy guy, I like tools
do the hard work for me. 

> If not the removal of the __nocast, would it be better to have a
> void pointer there?

I don't think that an explicit cast requires the introduction of a
temporary variable.

-- 
Uli Kunitz
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ