Can this be a invalid memory access? (was: Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers)

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

 



Hello

Regarding ioread8 et al.

On include/asm-generic/io.h is defined as:
extern unsigned int ioread8(void __iomem *);

On include/asm-generic/io.h:
static inline u8 ioread8(const volatile void __iomem *addr)

Please ignore the qualifiers right now. The first function returns an
unsigned integer, the second a u8.

Through #ifdefs, different arches uses the first or the second definitions.

If we consider this code:

u8 varA;
u8 varB;
u8 varC;
void * pvar=varB;
*pvar = ioread8(valid_memory);

Depending if ioread8 returns a u8 or a unsigned int, aren't we also
accessing varC?

Could not this be a problem?

If I decide to send a patch and fix it, is there a clever script that
I can run on my x86 computer to test if the patch works on all arches?


Thanks

-- 
Ricardo Ribalda
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux