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> |
||
---|---|---|
.. | ||
boot | ||
common | ||
configs | ||
kernel | ||
lib | ||
mach-aaec2000 | ||
mach-at91 | ||
mach-clps711x | ||
mach-clps7500 | ||
mach-davinci | ||
mach-ebsa110 | ||
mach-ep93xx | ||
mach-footbridge | ||
mach-h720x | ||
mach-imx | ||
mach-integrator | ||
mach-iop13xx | ||
mach-iop32x | ||
mach-iop33x | ||
mach-ixp4xx | ||
mach-ixp23xx | ||
mach-ixp2000 | ||
mach-kirkwood | ||
mach-ks8695 | ||
mach-l7200 | ||
mach-lh7a40x | ||
mach-loki | ||
mach-msm | ||
mach-mv78xx0 | ||
mach-mx2 | ||
mach-mx3 | ||
mach-netx | ||
mach-ns9xxx | ||
mach-omap1 | ||
mach-omap2 | ||
mach-orion5x | ||
mach-pnx4008 | ||
mach-pxa | ||
mach-realview | ||
mach-rpc | ||
mach-s3c2400 | ||
mach-s3c2410 | ||
mach-s3c2412 | ||
mach-s3c2440 | ||
mach-s3c2442 | ||
mach-s3c2443 | ||
mach-sa1100 | ||
mach-shark | ||
mach-versatile | ||
mm | ||
nwfpe | ||
oprofile | ||
plat-iop | ||
plat-mxc | ||
plat-omap | ||
plat-orion | ||
plat-s3c | ||
plat-s3c24xx | ||
tools | ||
vfp | ||
Kconfig | ||
Kconfig-nommu | ||
Kconfig.debug | ||
Makefile |