RE: [PATCH] RDMA/siw: Fix compiler warnings on 32-bit due to u64/pointer abuse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Joe Perches
> Sent: 27 August 2019 19:33
> On Tue, 2019-08-27 at 19:59 +0200, Geert Uytterhoeven wrote:
> > On Tue, Aug 27, 2019 at 7:46 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> > > On Tue, Aug 27, 2019 at 07:29:52PM +0200, Geert Uytterhoeven wrote:
> > > > On Tue, Aug 27, 2019 at 4:17 PM David Laight <David.Laight@xxxxxxxxxx> wrote:
> > > > > From: Geert Uytterhoeven
> > > > > > Sent: 19 August 2019 18:15
> > > > > ...
> > > > > > > I think a cast to unsigned long is rather more common.
> > > > > > >
> > > > > > > uintptr_t is used ~1300 times in the kernel.
> > > > > > > I believe a cast to unsigned long is much more common.
> 
> btw: apparently that's not true.
> 
> This grep may be incomplete but it seems there are fewer
> kernel uses of a cast to unsigned long then pointer:
> 
> $ git grep -P '\(\s*\w+(\s+\w+){0,3}(\s*\*)+\s*\)\s*\(\s*unsigned\s+long\s*\)'|wc -l
> 423
> 
> Maybe add a cast_to_ptr macro like
> 
> #define cast_to_ptr(type, val)	((type)(uintptr_t)(val))
> 
> though that may not save any horizontal space

And it is another bit of pointless obfuscation....

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux