Search Linux Wireless

Re: [PATCH 04/20] staging: brcm80211: various __iomem additions to softmac.

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

 



On Mon, Oct 10, 2011 at 04:23:28PM +0200, Rafał Miłecki wrote:
> > -#define CCREGS_FAST(si) (((char *)((si)->curmap) + PCI_16KB0_CCREGS_OFFSET))
> > +#define CCREGS_FAST(si) (((char __iomem *)((si)->curmap) + \
> > +                         PCI_16KB0_CCREGS_OFFSET))
> 
> I've a question (not to just you), should we prefer u8/u16/u32 types in code?
> If so, you could think to changing this since you already touch this code.
> 

The char is just so that the addition works, the caller will have to
cast it again.  It's up to the author to decide.

If you're going to be doing bitwise operations then you can run into
signedness bugs using char.

	printf("0x%x\n", (int) 0 | (char) -1);       /* 0xffffffff */
	printf("0x%x\n", (int) 0 | (unsigned char) -1);    /* 0xff */

Also if you are going to save hex digits to it, then it should be u8.
You occasionally see bugs like this:

	char x = 0xff;

	if (x == 0xff)
		printf("dead code here.\n");
	else
		printf("signed chars only reach up to 0x7f\n");

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux