27ac792ca0
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> |
||
---|---|---|
.. | ||
alchemy-flash.c | ||
amd76xrom.c | ||
autcpu12-nvram.c | ||
bast-flash.c | ||
cdb89712.c | ||
ceiva.c | ||
cfi_flagadm.c | ||
ck804xrom.c | ||
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 | ||
l440gx.c | ||
Makefile | ||
map_funcs.c | ||
mbx860.c | ||
netsc520.c | ||
nettel.c | ||
ocotea.c | ||
octagon-5066.c | ||
omap-toto-flash.c | ||
omap_nor.c | ||
pci.c | ||
pcmciamtd.c | ||
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 | ||
vmax301.c | ||
walnut.c | ||
wr_sbc82xx_flash.c |