kernel-fxtec-pro1x/drivers/mtd/maps
Andrea Righi 27ac792ca0 PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures
On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
boundary. For example:

	u64 val = PAGE_ALIGN(size);

always returns a value < 4GB even if size is greater than 4GB.

The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
example):

#define PAGE_SHIFT      12
#define PAGE_SIZE       (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK       (~(PAGE_SIZE-1))
...
#define PAGE_ALIGN(addr)       (((addr)+PAGE_SIZE-1)&PAGE_MASK)

The "~" is performed on a 32-bit value, so everything in "and" with
PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
Using the ALIGN() macro seems to be the right way, because it uses
typeof(addr) for the mask.

Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
include/linux/mm.h.

See also lkml discussion: http://lkml.org/lkml/2008/6/11/237

[akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
[akpm@linux-foundation.org: fix v850]
[akpm@linux-foundation.org: fix powerpc]
[akpm@linux-foundation.org: fix arm]
[akpm@linux-foundation.org: fix mips]
[akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
[akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
[akpm@linux-foundation.org: fix powerpc]
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 10:47:21 -07:00
..
alchemy-flash.c
amd76xrom.c
autcpu12-nvram.c
bast-flash.c
cdb89712.c
ceiva.c
cfi_flagadm.c
ck804xrom.c ck804rom: fix driver_data in probe table. 2008-05-27 07:34:38 -07:00
dbox2-flash.c
dc21285.c
dilnetpc.c
dmv182.c
ebony.c
edb7312.c
esb2rom.c
fortunet.c
h720x-flash.c
ichxrom.c
impa7.c
integrator-flash.c
intel_vr_nor.c
ipaq-flash.c
ixp4xx.c
ixp2000.c
Kconfig [MIPS] MTX-1 flash partition setup move to platform devices registration 2008-07-15 18:44:38 +01:00
l440gx.c
Makefile [MIPS] MTX-1 flash partition setup move to platform devices registration 2008-07-15 18:44:38 +01:00
map_funcs.c
mbx860.c
netsc520.c
nettel.c
ocotea.c
octagon-5066.c
omap-toto-flash.c
omap_nor.c ARM: OMAP: Change omap_cf.c and omap_nor.c to use omap_readw/writew instead of __REG 2008-07-03 12:24:41 +03:00
pci.c
pcmciamtd.c pcmcia: (re)move {pcmcia,pccard}_get_status 2008-06-24 15:33:44 +02:00
physmap.c
physmap_of.c
plat-ram.c
pmcmsp-flash.c
pmcmsp-ramroot.c
pxa2xx-flash.c
redwood.c
rpxlite.c
sa1100-flash.c
sbc8240.c
sbc_gxx.c
sc520cdp.c
scb2_flash.c
scx200_docflash.c
sharpsl-flash.c
solutionengine.c
sun_uflash.c
tqm8xxl.c
ts5500_flash.c
tsunami_flash.c
uclinux.c PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
vmax301.c
walnut.c
wr_sbc82xx_flash.c