linux/include/asm-m68knommu
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
..
Kbuild Add empty Kbuild files for 'make headers_install' in remaining arches. 2006-06-18 12:58:53 +01:00
MC68EZ328.h
MC68VZ328.h
MC68328.h
MC68332.h
a.out.h
anchor.h
atomic.h atomic.h: atomic_add_unless as inline. Remove system.h atomic.h circular dependency 2007-05-08 11:15:20 -07:00
auxvec.h
bitops.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
bootinfo.h
bootstd.h [PATCH] m68knommu: fix clobber list in uCdimm/uCsimm helper asm 2006-06-28 15:03:47 -07:00
bug.h
bugs.h
byteorder.h
cache.h
cachectl.h
cacheflush.h m68knommu: use tabs not spaces in cacheflush.h 2008-02-14 20:58:05 -08:00
checksum.h [NET]: M68Knommu checksum annotations and cleanups. 2006-12-02 21:23:08 -08:00
coldfire.h [PATCH] m68knommu: configurable frequency selection header 2006-06-25 21:04:24 -07:00
commproc.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
cputime.h
current.h
dbg.h
delay.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
device.h Driver core: add dev_archdata to struct device 2006-12-01 14:52:01 -08:00
div64.h
dma-mapping.h [PATCH] m68knommu: fix dma-mapping.h 2006-12-04 08:28:47 -08:00
dma.h m68knommu: update MAX_M68K_DMA_CHANNELS for some plattforms 2008-05-01 08:08:36 -07:00
elf.h Cleanup asm/{elf,page,user}.h: #ifdef __KERNEL__ is no longer needed 2008-02-07 08:42:30 -08:00
elia.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
emergency-restart.h
entry.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
errno.h
fb.h fbdev: detect primary display device 2007-07-17 10:23:11 -07:00
fcntl.h
flat.h Binfmt_flat: Add minimum support for the Blackfin relocations 2007-10-03 23:41:43 +08:00
fpu.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
futex.h
hardirq.h m68knommu: add prototype for ack_bad_irq 2007-07-26 11:05:20 -07:00
hw_irq.h m68knommu: create hw_irq.h 2007-07-25 11:05:01 -07:00
hwtest.h
io.h remove mm_{ptov,vtop}() 2008-02-06 10:41:01 -08:00
ioctl.h
ioctls.h
ipcbuf.h
irq.h m68knommu: generic irq handling 2007-07-19 10:04:50 -07:00
irq_regs.h [PATCH] m68knommu: fix up for the irq_handler_t changes 2006-11-20 10:16:49 -08:00
kdebug.h move die notifier handling to common code 2007-05-08 11:15:04 -07:00
kmap_types.h
kvm.h kvm: provide kvm.h for all architecture: fixes headers_install 2008-04-02 15:28:18 -07:00
linkage.h
local.h
m520xsim.h [PATCH] m68knommu: memory register defines for 520x ColdFire CPU's 2006-12-04 08:26:12 -08:00
m523xsim.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
m527xsim.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
m528xsim.h [PATCH] m68knommu: GPIO line defines for the ColdFire 5282 2007-03-06 18:08:38 -08:00
m532xsim.h [PATCH] m68knommu: ColdFire 532x register definitions 2006-06-25 17:43:33 -07:00
m5206sim.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
m5249sim.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
m5272sim.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
m5307sim.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
m5407sim.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
m68360.h m68knommu: generic irq handling 2007-07-19 10:04:50 -07:00
m68360_enet.h
m68360_pram.h
m68360_quicc.h
m68360_regs.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
machdep.h m68knommu: declare do_IRQ() 2008-03-04 08:04:11 -08:00
math-emu.h
mc146818rtc.h
mcfcache.h m68knommu: fix 528x ColdFire cache settings 2008-02-01 21:00:01 +11:00
mcfdma.h m68knommu: fix definition of MCFDMA_DIR_INV 2007-07-25 11:05:01 -07:00
mcfmbus.h Fix misc .c/.h comment typos 2006-11-30 05:24:39 +01:00
mcfne.h m68knomu: remove dead config symbols from m68knomu code 2008-02-05 09:44:21 -08:00
mcfpci.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
mcfpit.h [PATCH] m68knommu: read/write register access for PIT timer 2006-06-25 17:43:33 -07:00
mcfsim.h m68knomu: remove dead config symbols from m68knomu code 2008-02-05 09:44:21 -08:00
mcfsmc.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
mcftimer.h m68knomu: remove dead config symbols from m68knomu code 2008-02-05 09:44:21 -08:00
mcfuart.h m68knomu: remove dead config symbols from m68knomu code 2008-02-05 09:44:21 -08:00
mcfwdebug.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
md.h
mman.h
mmu.h
mmu_context.h [PATCH] x86: PARAVIRT: add hooks to intercept mm creation and destruction 2007-05-02 19:27:14 +02:00
module.h m68knommu: local module/elf definitions 2007-10-23 08:32:07 -07:00
movs.h
msgbuf.h
mutex.h
namei.h
nettel.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
openprom.h
oplib.h
page.h PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
page_offset.h [PATCH] m68knommu: use configurable RAM setup page_offset.h 2006-06-26 10:59:44 -07:00
param.h m68knommu: rework definition of HZ 2008-05-01 08:08:36 -07:00
pci.h PCI: remove pci_dac_dma_... APIs 2007-07-11 16:02:11 -07:00
percpu.h
pgalloc.h
pgtable.h m68knommu: include asm-generic/pgtable.h 2007-08-23 21:32:54 -07:00
poll.h
posix_types.h
processor.h fix file specification in comments 2006-10-03 23:01:26 +02:00
ptrace.h [PATCH] m68knommu: remove NO_FORMAT_VECi from ptrace.h header 2006-06-27 18:30:14 -07:00
quicc_simple.h
resource.h
rtc.h [PATCH] m68knommu: create rtc.h 2006-12-06 07:41:26 -08:00
scatterlist.h m68knommu: remove sg_address() 2007-10-23 12:42:47 +02:00
sections.h
segment.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
setup.h [PATCH] cleanup asm/setup.h userspace visibility 2006-12-07 08:39:46 -08:00
shm.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h [PATCH] irq-flags: M68KNOMMU: Use the new IRQF_ constants 2006-07-02 13:58:47 -07:00
smp.h
socket.h
sockios.h
spinlock.h
stat.h
statfs.h
string.h
system.h m68knommu: avoid unneccessary use of xchg() in set_mb() 2008-02-14 20:58:05 -08:00
termbits.h
termios.h
thread_info.h remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
timex.h m68knommu: fix tick timer definition for coldfire 2007-07-25 11:05:01 -07:00
tlb.h
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h
traps.h m68knommu: generic irq handling 2007-07-19 10:04:50 -07:00
types.h
uaccess.h m68knommu: define __clear_user macro 2007-10-23 08:32:07 -07:00
ucontext.h [PATCH] m68knommu: remove FP conditionals in ucontext struct 2006-12-06 07:41:26 -08:00
unaligned.h kernel: Move arches to use common unaligned access 2008-04-29 08:06:27 -07:00
unistd.h m68k{,nommu}: Wire up new timerfd syscalls 2008-03-04 08:04:11 -08:00
user.h