Jelajahi Sumber

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>
Andrea Righi 17 tahun lalu
induk
melakukan
27ac792ca0
57 mengubah file dengan 36 tambahan dan 74 penghapusan
  1. 1 0
      arch/arm/kernel/module.c
  2. 1 0
      arch/arm/plat-omap/fb.c
  3. 1 0
      arch/avr32/mm/ioremap.c
  4. 1 0
      arch/h8300/kernel/setup.c
  5. 1 0
      arch/m68k/amiga/chipram.c
  6. 1 0
      arch/m68knommu/kernel/setup.c
  7. 1 0
      arch/mips/kernel/module.c
  8. 1 0
      arch/mips/sgi-ip27/ip27-klnuma.c
  9. 1 0
      arch/powerpc/kernel/suspend.c
  10. 1 0
      arch/powerpc/lib/code-patching.c
  11. 1 1
      arch/sparc64/kernel/iommu_common.h
  12. 1 0
      arch/x86/kernel/module_64.c
  13. 1 0
      arch/xtensa/kernel/setup.c
  14. 1 0
      drivers/char/random.c
  15. 1 0
      drivers/ieee1394/iso.c
  16. 1 0
      drivers/media/video/pvrusb2/pvrusb2-dvb.c
  17. 1 0
      drivers/media/video/pvrusb2/pvrusb2-ioread.c
  18. 1 0
      drivers/media/video/uvc/uvc_queue.c
  19. 1 0
      drivers/media/video/videobuf-core.c
  20. 1 0
      drivers/mtd/maps/uclinux.c
  21. 1 0
      drivers/net/mlx4/eq.c
  22. 1 0
      drivers/pcmcia/electra_cf.c
  23. 1 0
      drivers/scsi/sun_esp.c
  24. 1 0
      drivers/video/acornfb.c
  25. 1 0
      drivers/video/imxfb.c
  26. 1 0
      drivers/video/omap/dispc.c
  27. 1 0
      drivers/video/omap/omapfb_main.c
  28. 1 0
      drivers/video/pxafb.c
  29. 1 0
      drivers/video/sa1100fb.c
  30. 0 3
      include/asm-alpha/page.h
  31. 1 3
      include/asm-arm/page-nommu.h
  32. 0 3
      include/asm-arm/page.h
  33. 0 3
      include/asm-avr32/page.h
  34. 0 3
      include/asm-blackfin/page.h
  35. 0 3
      include/asm-cris/page.h
  36. 0 3
      include/asm-frv/page.h
  37. 0 3
      include/asm-h8300/page.h
  38. 0 1
      include/asm-ia64/page.h
  39. 0 3
      include/asm-m32r/page.h
  40. 1 1
      include/asm-m68k/dvma.h
  41. 0 3
      include/asm-m68k/page.h
  42. 0 3
      include/asm-m68knommu/page.h
  43. 0 3
      include/asm-mips/page.h
  44. 1 1
      include/asm-mips/processor.h
  45. 0 3
      include/asm-mn10300/page.h
  46. 0 4
      include/asm-parisc/page.h
  47. 0 3
      include/asm-powerpc/page.h
  48. 0 3
      include/asm-s390/page.h
  49. 0 3
      include/asm-sh/page.h
  50. 0 3
      include/asm-sparc/page_32.h
  51. 0 3
      include/asm-sparc/page_64.h
  52. 0 3
      include/asm-um/page.h
  53. 0 4
      include/asm-v850/page.h
  54. 0 3
      include/asm-x86/page.h
  55. 0 2
      include/asm-xtensa/page.h
  56. 3 0
      include/linux/mm.h
  57. 1 0
      sound/core/info.c

+ 1 - 0
arch/arm/kernel/module.c

@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/moduleloader.h>
 #include <linux/moduleloader.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
+#include <linux/mm.h>
 #include <linux/elf.h>
 #include <linux/elf.h>
 #include <linux/vmalloc.h>
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
 #include <linux/slab.h>

+ 1 - 0
arch/arm/plat-omap/fb.c

@@ -23,6 +23,7 @@
 
 
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
+#include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
 #include <linux/bootmem.h>
 #include <linux/bootmem.h>

+ 1 - 0
arch/avr32/mm/ioremap.c

@@ -6,6 +6,7 @@
  * published by the Free Software Foundation.
  * published by the Free Software Foundation.
  */
  */
 #include <linux/vmalloc.h>
 #include <linux/vmalloc.h>
+#include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/io.h>
 
 

+ 1 - 0
arch/h8300/kernel/setup.c

@@ -20,6 +20,7 @@
 #include <linux/sched.h>
 #include <linux/sched.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
+#include <linux/mm.h>
 #include <linux/fs.h>
 #include <linux/fs.h>
 #include <linux/fb.h>
 #include <linux/fb.h>
 #include <linux/console.h>
 #include <linux/console.h>

+ 1 - 0
arch/m68k/amiga/chipram.c

@@ -9,6 +9,7 @@
 
 
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
+#include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/ioport.h>
 #include <linux/slab.h>
 #include <linux/slab.h>

+ 1 - 0
arch/m68knommu/kernel/setup.c

@@ -22,6 +22,7 @@
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/fb.h>
 #include <linux/fb.h>
 #include <linux/module.h>
 #include <linux/module.h>
+#include <linux/mm.h>
 #include <linux/console.h>
 #include <linux/console.h>
 #include <linux/errno.h>
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/string.h>

+ 1 - 0
arch/mips/kernel/module.c

@@ -22,6 +22,7 @@
 
 
 #include <linux/moduleloader.h>
 #include <linux/moduleloader.h>
 #include <linux/elf.h>
 #include <linux/elf.h>
+#include <linux/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
 #include <linux/fs.h>

+ 1 - 0
arch/mips/sgi-ip27/ip27-klnuma.c

@@ -4,6 +4,7 @@
  * Copyright 2000 - 2001 Kanoj Sarcar (kanoj@sgi.com)
  * Copyright 2000 - 2001 Kanoj Sarcar (kanoj@sgi.com)
  */
  */
 #include <linux/init.h>
 #include <linux/init.h>
+#include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/mmzone.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/nodemask.h>
 #include <linux/nodemask.h>

+ 1 - 0
arch/powerpc/kernel/suspend.c

@@ -7,6 +7,7 @@
  * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
  * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
  */
  */
 
 
+#include <linux/mm.h>
 #include <asm/page.h>
 #include <asm/page.h>
 
 
 /* References to section boundaries */
 /* References to section boundaries */

+ 1 - 0
arch/powerpc/lib/code-patching.c

@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/vmalloc.h>
 #include <linux/vmalloc.h>
 #include <linux/init.h>
 #include <linux/init.h>
+#include <linux/mm.h>
 #include <asm/page.h>
 #include <asm/page.h>
 #include <asm/code-patching.h>
 #include <asm/code-patching.h>
 
 

+ 1 - 1
arch/sparc64/kernel/iommu_common.h

@@ -23,7 +23,7 @@
 #define IO_PAGE_SHIFT			13
 #define IO_PAGE_SHIFT			13
 #define IO_PAGE_SIZE			(1UL << IO_PAGE_SHIFT)
 #define IO_PAGE_SIZE			(1UL << IO_PAGE_SHIFT)
 #define IO_PAGE_MASK			(~(IO_PAGE_SIZE-1))
 #define IO_PAGE_MASK			(~(IO_PAGE_SIZE-1))
-#define IO_PAGE_ALIGN(addr)		(((addr)+IO_PAGE_SIZE-1)&IO_PAGE_MASK)
+#define IO_PAGE_ALIGN(addr)		ALIGN(addr, IO_PAGE_SIZE)
 
 
 #define IO_TSB_ENTRIES			(128*1024)
 #define IO_TSB_ENTRIES			(128*1024)
 #define IO_TSB_SIZE			(IO_TSB_ENTRIES * 8)
 #define IO_TSB_SIZE			(IO_TSB_ENTRIES * 8)

+ 1 - 0
arch/x86/kernel/module_64.c

@@ -22,6 +22,7 @@
 #include <linux/fs.h>
 #include <linux/fs.h>
 #include <linux/string.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
+#include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/bug.h>
 #include <linux/bug.h>
 
 

+ 1 - 0
arch/xtensa/kernel/setup.c

@@ -16,6 +16,7 @@
 
 
 #include <linux/errno.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/init.h>
+#include <linux/mm.h>
 #include <linux/proc_fs.h>
 #include <linux/proc_fs.h>
 #include <linux/screen_info.h>
 #include <linux/screen_info.h>
 #include <linux/bootmem.h>
 #include <linux/bootmem.h>

+ 1 - 0
drivers/char/random.c

@@ -236,6 +236,7 @@
 #include <linux/fs.h>
 #include <linux/fs.h>
 #include <linux/genhd.h>
 #include <linux/genhd.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
+#include <linux/mm.h>
 #include <linux/spinlock.h>
 #include <linux/spinlock.h>
 #include <linux/percpu.h>
 #include <linux/percpu.h>
 #include <linux/cryptohash.h>
 #include <linux/cryptohash.h>

+ 1 - 0
drivers/ieee1394/iso.c

@@ -11,6 +11,7 @@
 
 
 #include <linux/pci.h>
 #include <linux/pci.h>
 #include <linux/sched.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 
 
 #include "hosts.h"
 #include "hosts.h"

+ 1 - 0
drivers/media/video/pvrusb2/pvrusb2-dvb.c

@@ -20,6 +20,7 @@
 
 
 #include <linux/kthread.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
 #include <linux/freezer.h>
+#include <linux/mm.h>
 #include "dvbdev.h"
 #include "dvbdev.h"
 #include "pvrusb2-debug.h"
 #include "pvrusb2-debug.h"
 #include "pvrusb2-hdw-internal.h"
 #include "pvrusb2-hdw-internal.h"

+ 1 - 0
drivers/media/video/pvrusb2/pvrusb2-ioread.c

@@ -22,6 +22,7 @@
 #include "pvrusb2-debug.h"
 #include "pvrusb2-debug.h"
 #include <linux/errno.h>
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/string.h>
+#include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
 #include <linux/mutex.h>
 #include <asm/uaccess.h>
 #include <asm/uaccess.h>

+ 1 - 0
drivers/media/video/uvc/uvc_queue.c

@@ -13,6 +13,7 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/version.h>
 #include <linux/version.h>
+#include <linux/mm.h>
 #include <linux/list.h>
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/usb.h>
 #include <linux/usb.h>

+ 1 - 0
drivers/media/video/videobuf-core.c

@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/moduleparam.h>
+#include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 
 

+ 1 - 0
drivers/mtd/maps/uclinux.c

@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/fs.h>
+#include <linux/mm.h>
 #include <linux/major.h>
 #include <linux/major.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/map.h>

+ 1 - 0
drivers/net/mlx4/eq.c

@@ -33,6 +33,7 @@
 
 
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
+#include <linux/mm.h>
 #include <linux/dma-mapping.h>
 #include <linux/dma-mapping.h>
 
 
 #include <linux/mlx4/cmd.h>
 #include <linux/mlx4/cmd.h>

+ 1 - 0
drivers/pcmcia/electra_cf.c

@@ -28,6 +28,7 @@
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
+#include <linux/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/vmalloc.h>
 #include <linux/of_platform.h>
 #include <linux/of_platform.h>
 
 

+ 1 - 0
drivers/scsi/sun_esp.c

@@ -7,6 +7,7 @@
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/module.h>
+#include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/init.h>
 
 
 #include <asm/irq.h>
 #include <asm/irq.h>

+ 1 - 0
drivers/video/acornfb.c

@@ -23,6 +23,7 @@
 #include <linux/string.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <linux/ctype.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
+#include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/fb.h>
 #include <linux/fb.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>

+ 1 - 0
drivers/video/imxfb.c

@@ -24,6 +24,7 @@
 #include <linux/string.h>
 #include <linux/string.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
+#include <linux/mm.h>
 #include <linux/fb.h>
 #include <linux/fb.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/init.h>

+ 1 - 0
drivers/video/omap/dispc.c

@@ -20,6 +20,7 @@
  */
  */
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/dma-mapping.h>
 #include <linux/dma-mapping.h>
+#include <linux/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/vmalloc.h>
 #include <linux/clk.h>
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/io.h>

+ 1 - 0
drivers/video/omap/omapfb_main.c

@@ -25,6 +25,7 @@
  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
  */
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
+#include <linux/mm.h>
 #include <linux/uaccess.h>
 #include <linux/uaccess.h>
 
 
 #include <asm/mach-types.h>
 #include <asm/mach-types.h>

+ 1 - 0
drivers/video/pxafb.c

@@ -30,6 +30,7 @@
 #include <linux/string.h>
 #include <linux/string.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
+#include <linux/mm.h>
 #include <linux/fb.h>
 #include <linux/fb.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/init.h>

+ 1 - 0
drivers/video/sa1100fb.c

@@ -167,6 +167,7 @@
 #include <linux/string.h>
 #include <linux/string.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
+#include <linux/mm.h>
 #include <linux/fb.h>
 #include <linux/fb.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/init.h>

+ 0 - 3
include/asm-alpha/page.h

@@ -80,9 +80,6 @@ typedef struct page *pgtable_t;
 
 
 #endif /* !__ASSEMBLY__ */
 #endif /* !__ASSEMBLY__ */
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #define __pa(x)			((unsigned long) (x) - PAGE_OFFSET)
 #define __pa(x)			((unsigned long) (x) - PAGE_OFFSET)
 #define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
 #define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
 #ifndef CONFIG_DISCONTIGMEM
 #ifndef CONFIG_DISCONTIGMEM

+ 1 - 3
include/asm-arm/page-nommu.h

@@ -7,6 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  * published by the Free Software Foundation.
  */
  */
+
 #ifndef _ASMARM_PAGE_NOMMU_H
 #ifndef _ASMARM_PAGE_NOMMU_H
 #define _ASMARM_PAGE_NOMMU_H
 #define _ASMARM_PAGE_NOMMU_H
 
 
@@ -42,9 +43,6 @@ typedef unsigned long pgprot_t;
 #define __pmd(x)        (x)
 #define __pmd(x)        (x)
 #define __pgprot(x)     (x)
 #define __pgprot(x)     (x)
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 extern unsigned long memory_start;
 extern unsigned long memory_start;
 extern unsigned long memory_end;
 extern unsigned long memory_end;
 
 

+ 0 - 3
include/asm-arm/page.h

@@ -15,9 +15,6 @@
 #define PAGE_SIZE		(1UL << PAGE_SHIFT)
 #define PAGE_SIZE		(1UL << PAGE_SHIFT)
 #define PAGE_MASK		(~(PAGE_SIZE-1))
 #define PAGE_MASK		(~(PAGE_SIZE-1))
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #ifndef __ASSEMBLY__
 #ifndef __ASSEMBLY__
 
 
 #ifndef CONFIG_MMU
 #ifndef CONFIG_MMU

+ 0 - 3
include/asm-avr32/page.h

@@ -57,9 +57,6 @@ static inline int get_order(unsigned long size)
 
 
 #endif /* !__ASSEMBLY__ */
 #endif /* !__ASSEMBLY__ */
 
 
-/* Align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
 /*
 /*
  * The hardware maps the virtual addresses 0x80000000 -> 0x9fffffff
  * The hardware maps the virtual addresses 0x80000000 -> 0x9fffffff
  * permanently to the physical addresses 0x00000000 -> 0x1fffffff when
  * permanently to the physical addresses 0x00000000 -> 0x1fffffff when

+ 0 - 3
include/asm-blackfin/page.h

@@ -51,9 +51,6 @@ typedef struct page *pgtable_t;
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 extern unsigned long memory_start;
 extern unsigned long memory_start;
 extern unsigned long memory_end;
 extern unsigned long memory_end;
 
 

+ 0 - 3
include/asm-cris/page.h

@@ -60,9 +60,6 @@ typedef struct page *pgtable_t;
 
 
 #define page_to_phys(page)     __pa((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
 #define page_to_phys(page)     __pa((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #ifndef __ASSEMBLY__
 #ifndef __ASSEMBLY__
 
 
 #endif /* __ASSEMBLY__ */
 #endif /* __ASSEMBLY__ */

+ 0 - 3
include/asm-frv/page.h

@@ -40,9 +40,6 @@ typedef struct page *pgtable_t;
 #define __pgprot(x)	((pgprot_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 #define PTE_MASK	PAGE_MASK
 #define PTE_MASK	PAGE_MASK
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
 #define devmem_is_allowed(pfn)	1
 #define devmem_is_allowed(pfn)	1
 
 
 #define __pa(vaddr)		virt_to_phys((void *) (unsigned long) (vaddr))
 #define __pa(vaddr)		virt_to_phys((void *) (unsigned long) (vaddr))

+ 0 - 3
include/asm-h8300/page.h

@@ -43,9 +43,6 @@ typedef struct page *pgtable_t;
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 extern unsigned long memory_start;
 extern unsigned long memory_start;
 extern unsigned long memory_end;
 extern unsigned long memory_end;
 
 

+ 0 - 1
include/asm-ia64/page.h

@@ -40,7 +40,6 @@
 
 
 #define PAGE_SIZE		(__IA64_UL_CONST(1) << PAGE_SHIFT)
 #define PAGE_SIZE		(__IA64_UL_CONST(1) << PAGE_SHIFT)
 #define PAGE_MASK		(~(PAGE_SIZE - 1))
 #define PAGE_MASK		(~(PAGE_SIZE - 1))
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
 
 
 #define PERCPU_PAGE_SHIFT	16	/* log2() of max. size of per-CPU area */
 #define PERCPU_PAGE_SHIFT	16	/* log2() of max. size of per-CPU area */
 #define PERCPU_PAGE_SIZE	(__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
 #define PERCPU_PAGE_SIZE	(__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)

+ 0 - 3
include/asm-m32r/page.h

@@ -41,9 +41,6 @@ typedef struct page *pgtable_t;
 
 
 #endif /* !__ASSEMBLY__ */
 #endif /* !__ASSEMBLY__ */
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
 /*
 /*
  * This handles the memory map.. We could make this a config
  * This handles the memory map.. We could make this a config
  * option, but too many people screw it up, and too few need
  * option, but too many people screw it up, and too few need

+ 1 - 1
include/asm-m68k/dvma.h

@@ -13,7 +13,7 @@
 #define DVMA_PAGE_SHIFT	13
 #define DVMA_PAGE_SHIFT	13
 #define DVMA_PAGE_SIZE	(1UL << DVMA_PAGE_SHIFT)
 #define DVMA_PAGE_SIZE	(1UL << DVMA_PAGE_SHIFT)
 #define DVMA_PAGE_MASK	(~(DVMA_PAGE_SIZE-1))
 #define DVMA_PAGE_MASK	(~(DVMA_PAGE_SIZE-1))
-#define DVMA_PAGE_ALIGN(addr)	(((addr)+DVMA_PAGE_SIZE-1)&DVMA_PAGE_MASK)
+#define DVMA_PAGE_ALIGN(addr)	ALIGN(addr, DVMA_PAGE_SIZE)
 
 
 extern void dvma_init(void);
 extern void dvma_init(void);
 extern int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
 extern int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,

+ 0 - 3
include/asm-m68k/page.h

@@ -103,9 +103,6 @@ typedef struct page *pgtable_t;
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #endif /* !__ASSEMBLY__ */
 #endif /* !__ASSEMBLY__ */
 
 
 #include <asm/page_offset.h>
 #include <asm/page_offset.h>

+ 0 - 3
include/asm-m68knommu/page.h

@@ -43,9 +43,6 @@ typedef struct page *pgtable_t;
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 extern unsigned long memory_start;
 extern unsigned long memory_start;
 extern unsigned long memory_end;
 extern unsigned long memory_end;
 
 

+ 0 - 3
include/asm-mips/page.h

@@ -137,9 +137,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
 
 
 #endif /* !__ASSEMBLY__ */
 #endif /* !__ASSEMBLY__ */
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
 /*
 /*
  * __pa()/__va() should be used only during mem init.
  * __pa()/__va() should be used only during mem init.
  */
  */

+ 1 - 1
include/asm-mips/processor.h

@@ -45,7 +45,7 @@ extern unsigned int vced_count, vcei_count;
  * This decides where the kernel will search for a free chunk of vm
  * This decides where the kernel will search for a free chunk of vm
  * space during mmap's.
  * space during mmap's.
  */
  */
-#define TASK_UNMAPPED_BASE	(PAGE_ALIGN(TASK_SIZE / 3))
+#define TASK_UNMAPPED_BASE	((TASK_SIZE / 3) & ~(PAGE_SIZE))
 #endif
 #endif
 
 
 #ifdef CONFIG_64BIT
 #ifdef CONFIG_64BIT

+ 0 - 3
include/asm-mn10300/page.h

@@ -61,9 +61,6 @@ typedef struct page *pgtable_t;
 
 
 #endif /* !__ASSEMBLY__ */
 #endif /* !__ASSEMBLY__ */
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
 /*
 /*
  * This handles the memory map.. We could make this a config
  * This handles the memory map.. We could make this a config
  * option, but too many people screw it up, and too few need
  * option, but too many people screw it up, and too few need

+ 0 - 4
include/asm-parisc/page.h

@@ -119,10 +119,6 @@ extern int npmem_ranges;
 #define PMD_ENTRY_SIZE	(1UL << BITS_PER_PMD_ENTRY)
 #define PMD_ENTRY_SIZE	(1UL << BITS_PER_PMD_ENTRY)
 #define PTE_ENTRY_SIZE	(1UL << BITS_PER_PTE_ENTRY)
 #define PTE_ENTRY_SIZE	(1UL << BITS_PER_PTE_ENTRY)
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
-
 #define LINUX_GATEWAY_SPACE     0
 #define LINUX_GATEWAY_SPACE     0
 
 
 /* This governs the relationship between virtual and physical addresses.
 /* This governs the relationship between virtual and physical addresses.

+ 0 - 3
include/asm-powerpc/page.h

@@ -119,9 +119,6 @@ extern phys_addr_t kernstart_addr;
 /* align addr on a size boundary - adjust address up if needed */
 /* align addr on a size boundary - adjust address up if needed */
 #define _ALIGN(addr,size)     _ALIGN_UP(addr,size)
 #define _ALIGN(addr,size)     _ALIGN_UP(addr,size)
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	_ALIGN(addr, PAGE_SIZE)
-
 /*
 /*
  * Don't compare things with KERNELBASE or PAGE_OFFSET to test for
  * Don't compare things with KERNELBASE or PAGE_OFFSET to test for
  * "kernelness", use is_kernel_addr() - it should do what you want.
  * "kernelness", use is_kernel_addr() - it should do what you want.

+ 0 - 3
include/asm-s390/page.h

@@ -138,9 +138,6 @@ void arch_alloc_page(struct page *page, int order);
 
 
 #endif /* !__ASSEMBLY__ */
 #endif /* !__ASSEMBLY__ */
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #define __PAGE_OFFSET           0x0UL
 #define __PAGE_OFFSET           0x0UL
 #define PAGE_OFFSET             0x0UL
 #define PAGE_OFFSET             0x0UL
 #define __pa(x)                 (unsigned long)(x)
 #define __pa(x)                 (unsigned long)(x)

+ 0 - 3
include/asm-sh/page.h

@@ -22,9 +22,6 @@
 #define PAGE_MASK	(~(PAGE_SIZE-1))
 #define PAGE_MASK	(~(PAGE_SIZE-1))
 #define PTE_MASK	PAGE_MASK
 #define PTE_MASK	PAGE_MASK
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
 #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
 #define HPAGE_SHIFT	16
 #define HPAGE_SHIFT	16
 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)

+ 0 - 3
include/asm-sparc/page_32.h

@@ -134,9 +134,6 @@ BTFIXUPDEF_SETHI(sparc_unmapped_base)
 
 
 #endif /* !(__ASSEMBLY__) */
 #endif /* !(__ASSEMBLY__) */
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)  (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #define PAGE_OFFSET	0xf0000000
 #define PAGE_OFFSET	0xf0000000
 #ifndef __ASSEMBLY__
 #ifndef __ASSEMBLY__
 extern unsigned long phys_base;
 extern unsigned long phys_base;

+ 0 - 3
include/asm-sparc/page_64.h

@@ -106,9 +106,6 @@ typedef struct page *pgtable_t;
 
 
 #endif /* !(__ASSEMBLY__) */
 #endif /* !(__ASSEMBLY__) */
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 /* We used to stick this into a hard-coded global register (%g4)
 /* We used to stick this into a hard-coded global register (%g4)
  * but that does not make sense anymore.
  * but that does not make sense anymore.
  */
  */

+ 0 - 3
include/asm-um/page.h

@@ -92,9 +92,6 @@ typedef struct page *pgtable_t;
 #define __pgd(x) ((pgd_t) { (x) } )
 #define __pgd(x) ((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 extern unsigned long uml_physmem;
 extern unsigned long uml_physmem;
 
 
 #define PAGE_OFFSET (uml_physmem)
 #define PAGE_OFFSET (uml_physmem)

+ 0 - 4
include/asm-v850/page.h

@@ -94,10 +94,6 @@ typedef unsigned long pgprot_t;
 #endif /* !__ASSEMBLY__ */
 #endif /* !__ASSEMBLY__ */
 
 
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
-
 /* No current v850 processor has virtual memory.  */
 /* No current v850 processor has virtual memory.  */
 #define __virt_to_phys(addr)	(addr)
 #define __virt_to_phys(addr)	(addr)
 #define __phys_to_virt(addr)	(addr)
 #define __phys_to_virt(addr)	(addr)

+ 0 - 3
include/asm-x86/page.h

@@ -34,9 +34,6 @@
 
 
 #define HUGE_MAX_HSTATE 2
 #define HUGE_MAX_HSTATE 2
 
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #ifndef __ASSEMBLY__
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
 #include <linux/types.h>
 #endif
 #endif

+ 0 - 2
include/asm-xtensa/page.h

@@ -26,13 +26,11 @@
 
 
 /*
 /*
  * PAGE_SHIFT determines the page size
  * PAGE_SHIFT determines the page size
- * PAGE_ALIGN(x) aligns the pointer to the (next) page boundary
  */
  */
 
 
 #define PAGE_SHIFT		12
 #define PAGE_SHIFT		12
 #define PAGE_SIZE		(__XTENSA_UL_CONST(1) << PAGE_SHIFT)
 #define PAGE_SIZE		(__XTENSA_UL_CONST(1) << PAGE_SHIFT)
 #define PAGE_MASK		(~(PAGE_SIZE-1))
 #define PAGE_MASK		(~(PAGE_SIZE-1))
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE - 1) & PAGE_MASK)
 
 
 #define PAGE_OFFSET		XCHAL_KSEG_CACHED_VADDR
 #define PAGE_OFFSET		XCHAL_KSEG_CACHED_VADDR
 #define MAX_MEM_PFN		XCHAL_KSEG_SIZE
 #define MAX_MEM_PFN		XCHAL_KSEG_SIZE

+ 3 - 0
include/linux/mm.h

@@ -41,6 +41,9 @@ extern unsigned long mmap_min_addr;
 
 
 #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
 #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
 
 
+/* to align the pointer to the (next) page boundary */
+#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
+
 /*
 /*
  * Linux kernel virtual memory manager primitives.
  * Linux kernel virtual memory manager primitives.
  * The idea being to have a "virtual" mm in the same way
  * The idea being to have a "virtual" mm in the same way

+ 1 - 0
sound/core/info.c

@@ -21,6 +21,7 @@
 
 
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/time.h>
+#include <linux/mm.h>
 #include <linux/smp_lock.h>
 #include <linux/smp_lock.h>
 #include <linux/string.h>
 #include <linux/string.h>
 #include <sound/core.h>
 #include <sound/core.h>