android_kernel_motorola_sm6225/drivers/mtd/maps
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
..
alchemy-flash.c [MTD] Remove useless references to MIPS_HYDROGEN3 and MIPS_MIRAGE_WHY. 2007-07-23 12:50:51 +01:00
amd76xrom.c [MTD] [MAPS] amd76xrom warning fix 2007-02-18 16:42:25 +00:00
autcpu12-nvram.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
bast-flash.c [MTD] [MAPS] fix platform driver hotplug/coldplug 2008-04-22 14:14:26 +01:00
cdb89712.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
ceiva.c [MTD] replace kmalloc+memset with kzalloc 2006-11-28 23:47:21 +00:00
cfi_flagadm.c Fix typos in doc and comments 2006-11-30 05:32:19 +01:00
ck804xrom.c ck804rom: fix driver_data in probe table. 2008-05-27 07:34:38 -07:00
dbox2-flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
dc21285.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
dilnetpc.c [MTD] [MAPS] dilnetpc: Fix printk warning 2007-03-08 09:46:28 +00:00
dmv182.c fix file specification in comments 2006-10-03 23:01:26 +02:00
ebony.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
edb7312.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
esb2rom.c [MTD] ESB2 check for closed ROM window 2007-03-08 09:21:42 +00:00
fortunet.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
h720x-flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
ichxrom.c [MTD] [MAPS] ichxrom warning fix 2007-02-18 16:42:51 +00:00
impa7.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
integrator-flash.c [MTD] [MAPS] fix platform driver hotplug/coldplug 2008-04-22 14:14:26 +01:00
intel_vr_nor.c [MTD] map driver for NOR flash on the Intel Vermilion Range chipset 2007-09-23 18:51:25 +01:00
ipaq-flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
ixp4xx.c [MTD] [MAPS] fix platform driver hotplug/coldplug 2008-04-22 14:14:26 +01:00
ixp2000.c [MTD] [MAPS] fix platform driver hotplug/coldplug 2008-04-22 14:14:26 +01:00
Kconfig [MIPS] MTX-1 flash partition setup move to platform devices registration 2008-07-15 18:44:38 +01:00
l440gx.c [MTD] Switch to pci_get_device and do ref counting 2006-09-22 10:19:20 +01:00
Makefile [MIPS] MTX-1 flash partition setup move to platform devices registration 2008-07-15 18:44:38 +01:00
map_funcs.c [MTD] XIP for AMD CFI flash. 2005-06-29 14:18:40 +02:00
mbx860.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
netsc520.c [MTD] [MAPS] netsc520 warning fix 2007-02-18 16:41:31 +00:00
nettel.c [MTD] [MAPS] Cleanup nettel map driver 2007-06-28 23:02:59 +01:00
ocotea.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
octagon-5066.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
omap-toto-flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
omap_nor.c ARM: OMAP: Change omap_cf.c and omap_nor.c to use omap_readw/writew instead of __REG 2008-07-03 12:24:41 +03:00
pci.c [PATCH] Dead code in mtd/maps/pci.c 2006-03-31 12:18:49 -08:00
pcmciamtd.c pcmcia: (re)move {pcmcia,pccard}_get_status 2008-06-24 15:33:44 +02:00
physmap.c [MTD] [MAPS] fix platform driver hotplug/coldplug 2008-04-22 14:14:26 +01:00
physmap_of.c [MTD] Factor out OF partition support from the NOR driver. 2008-02-03 18:06:48 +11:00
plat-ram.c drivers: fix integer as NULL pointer warnings 2008-04-28 17:31:13 -07:00
pmcmsp-flash.c [MTD] replace remaining __FUNCTION__ occurrences 2008-04-22 12:36:04 +01:00
pmcmsp-ramroot.c [MTD] Remove references to ROOT_DEV from map drivers. 2007-06-28 20:13:27 +01:00
pxa2xx-flash.c Reinstate lost flush_ioremap_region() fix to pxa2xx-flash driver 2007-10-15 12:55:20 -07:00
redwood.c [MTD] Cleanup of 'ioremap balanced with iounmap for drivers/mtd subsystem' 2006-10-02 09:48:23 +01:00
rpxlite.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sa1100-flash.c [MTD] [MAPS] fix platform driver hotplug/coldplug 2008-04-22 14:14:26 +01:00
sbc8240.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
sbc_gxx.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
sc520cdp.c [MTD] [MAPS] sc520cdp warning fix 2007-02-18 16:41:01 +00:00
scb2_flash.c [MTD] [NOR] Fix incorrect interface code for x16/x32 chips 2008-01-10 22:07:12 +00:00
scx200_docflash.c [MTD] Switch to pci_get_device and do ref counting 2006-09-22 10:19:20 +01:00
sharpsl-flash.c [MTD] fix minor typo in the MTD map driver for SHARP SL series 2008-04-22 19:12:44 +01:00
solutionengine.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sun_uflash.c [SPARC/64] constify of_get_property return: drivers 2007-04-26 01:54:27 -07:00
tqm8xxl.c [MTD] replace remaining __FUNCTION__ occurrences 2008-04-22 12:36:04 +01:00
ts5500_flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
tsunami_flash.c [PATCH] tsunami_flash: fix "parse error before ';' token" 2006-02-01 08:53:10 -08:00
uclinux.c PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
vmax301.c [PATCH] drivers/mtd/maps/vmax301.c: fix off by one vmax_mtd 2006-03-31 12:18:49 -08:00
walnut.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
wr_sbc82xx_flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00