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> |
||
---|---|---|
.. | ||
cpu-sh2 | ||
cpu-sh2a | ||
cpu-sh3 | ||
cpu-sh4 | ||
cpu-sh5 | ||
dreamcast | ||
hd64465 | ||
landisk | ||
sh03 | ||
.gitignore | ||
a.out.h | ||
adc.h | ||
addrspace.h | ||
atomic-grb.h | ||
atomic-irq.h | ||
atomic-llsc.h | ||
atomic.h | ||
auxvec.h | ||
bitops-grb.h | ||
bitops-irq.h | ||
bitops.h | ||
bug.h | ||
bugs.h | ||
byteorder.h | ||
cache.h | ||
cacheflush.h | ||
checksum_32.h | ||
checksum_64.h | ||
checksum.h | ||
clock.h | ||
cmpxchg-grb.h | ||
cmpxchg-irq.h | ||
cpu-features.h | ||
cputime.h | ||
current.h | ||
delay.h | ||
device.h | ||
div64.h | ||
dma-mapping.h | ||
dma.h | ||
dmabrg.h | ||
edosk7705.h | ||
elf.h | ||
emergency-restart.h | ||
entry-macros.S | ||
errno.h | ||
fb.h | ||
fcntl.h | ||
fixmap.h | ||
flat.h | ||
fpu.h | ||
freq.h | ||
futex-irq.h | ||
futex.h | ||
gpio.h | ||
hardirq.h | ||
hd64461.h | ||
heartbeat.h | ||
hp6xx.h | ||
hugetlb.h | ||
hw_irq.h | ||
i2c-sh7760.h | ||
ide.h | ||
ilsel.h | ||
io_generic.h | ||
io_trapped.h | ||
io.h | ||
ioctl.h | ||
ioctls.h | ||
ipcbuf.h | ||
irq_regs.h | ||
irq.h | ||
irqflags_32.h | ||
irqflags_64.h | ||
irqflags.h | ||
Kbuild | ||
kdebug.h | ||
kexec.h | ||
kgdb.h | ||
kmap_types.h | ||
kvm.h | ||
lboxre2.h | ||
linkage.h | ||
local.h | ||
machvec.h | ||
magicpanelr2.h | ||
mc146818rtc.h | ||
microdev.h | ||
migor.h | ||
mman.h | ||
mmu_context_32.h | ||
mmu_context_64.h | ||
mmu_context.h | ||
mmu.h | ||
mmzone.h | ||
module.h | ||
msgbuf.h | ||
mutex.h | ||
namei.h | ||
page.h | ||
param.h | ||
parport.h | ||
pci.h | ||
percpu.h | ||
pgalloc.h | ||
pgtable_32.h | ||
pgtable_64.h | ||
pgtable.h | ||
pm.h | ||
poll.h | ||
posix_types_32.h | ||
posix_types_64.h | ||
posix_types.h | ||
processor_32.h | ||
processor_64.h | ||
processor.h | ||
ptrace.h | ||
push-switch.h | ||
r7780rp.h | ||
resource.h | ||
rtc.h | ||
rts7751r2d.h | ||
rwsem.h | ||
scatterlist.h | ||
sdk7780.h | ||
se7206.h | ||
se7343.h | ||
se7721.h | ||
se7722.h | ||
se7751.h | ||
se7780.h | ||
se.h | ||
sections.h | ||
segment.h | ||
semaphore.h | ||
sembuf.h | ||
serial.h | ||
setup.h | ||
sfp-machine.h | ||
sh_bios.h | ||
sh_keysc.h | ||
shmbuf.h | ||
shmin.h | ||
shmparam.h | ||
sigcontext.h | ||
siginfo.h | ||
signal.h | ||
smc37c93x.h | ||
smp.h | ||
snapgear.h | ||
socket.h | ||
sockios.h | ||
sparsemem.h | ||
spi.h | ||
spinlock_types.h | ||
spinlock.h | ||
stat.h | ||
statfs.h | ||
string_32.h | ||
string_64.h | ||
string.h | ||
system_32.h | ||
system_64.h | ||
system.h | ||
systemh7751.h | ||
termbits.h | ||
termios.h | ||
thread_info.h | ||
timer.h | ||
timex.h | ||
titan.h | ||
tlb_64.h | ||
tlb.h | ||
tlbflush.h | ||
topology.h | ||
types.h | ||
uaccess_32.h | ||
uaccess_64.h | ||
uaccess.h | ||
ubc.h | ||
ucontext.h | ||
unaligned.h | ||
unistd_32.h | ||
unistd_64.h | ||
unistd.h | ||
user.h | ||
vga.h | ||
watchdog.h | ||
xor.h |