linux/include/asm-mn10300
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
..
proc-mn103e010 mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
unit-asb2303 mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
unit-asb2305 mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
.gitignore mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
atomic.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
auxvec.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
bitops.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
bug.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
bugs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
busctl-regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
byteorder.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
cache.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
cacheflush.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
checksum.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
cpu-regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
cputime.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
current.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
delay.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
device.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
div64.h rename div64_64 to div64_u64 2008-05-01 08:03:58 -07:00
dma-mapping.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
dma.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
dmactl-regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
elf.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
emergency-restart.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
errno.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
exceptions.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
fb.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
fcntl.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
fpu.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
frame.inc mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
futex.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
gdb-stub.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
hardirq.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
highmem.h Final removal of FASTCALL()/fastcall 2008-02-13 16:21:18 -08:00
hw_irq.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
ide.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
intctl-regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
io.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
ioctl.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
ioctls.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
ipc.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
ipcbuf.h MN10300: Fix typo in header guard 2008-05-28 07:59:06 -07:00
irq_regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
irq.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
Kbuild Really unexport asm/page.h 2008-03-06 08:13:47 -08:00
kdebug.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
kmap_types.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
kprobes.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
kvm.h kvm: provide kvm.h for all architecture: fixes headers_install 2008-04-02 15:28:18 -07:00
linkage.h Final removal of FASTCALL()/fastcall 2008-02-13 16:21:18 -08:00
local.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
mc146818rtc.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
mman.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
mmu_context.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
mmu.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
module.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
msgbuf.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
mutex.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
namei.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
nmi.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
page_offset.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
page.h PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
param.h MN10300: define HZ as a config option 2008-02-23 17:12:13 -08:00
pci.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
percpu.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
pgalloc.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pio-regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
poll.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
posix_types.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
processor.h MN10300: Make cpu_relax() invoke barrier() 2008-05-08 10:49:39 -07:00
ptrace.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
reset-regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
resource.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
rtc-regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
rtc.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
scatterlist.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
sections.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
serial-regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
serial.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
setup.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
shmbuf.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
shmparam.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
sigcontext.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
siginfo.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
signal.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
smp.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
socket.h MN10300: define SO_MARK 2008-02-23 17:12:13 -08:00
sockios.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
spinlock.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
stat.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
statfs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
string.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
system.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
termbits.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
termios.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
thread_info.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
timer-regs.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
timex.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
tlb.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
tlbflush.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
topology.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
types.h mn10300: types: use <asm-generic/int-*.h> for the mn10300 architecture 2008-05-02 16:18:31 -07:00
uaccess.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
ucontext.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
unaligned.h kernel: Move arches to use common unaligned access 2008-04-29 08:06:27 -07:00
unistd.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
user.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
vga.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
xor.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00