dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/sound/core
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
..
oss [ALSA] Add more fallbacks to OSS PHONEOUT mixer map 2008-04-24 12:00:07 +02:00
seq ALSA: remove CONFIG_KMOD from sound 2008-07-10 09:32:58 +02:00
Kconfig [ALSA] Replace CONFIG_SND_DEBUG_DETECT with CONFIG_SND_DEBUG_VERBOSE 2008-05-27 15:56:21 +02:00
Makefile [ALSA] Move vmaster code to sound core 2008-04-24 12:00:12 +02:00
control.c ALSA: make snd_ctl_elem_read() and snd_ctl_elem_write() static 2008-06-13 16:48:49 +02:00
control_compat.c [ALSA] copy_ctl_value_from_user() warning fix 2008-01-31 17:29:34 +01:00
device.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
hwdep.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
hwdep_compat.c [PATCH] hwdep_compat missed __user annotations 2006-10-10 15:37:21 -07:00
info.c PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
info_oss.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
init.c device create: sound: convert device_create to device_create_drvdata 2008-07-21 21:54:44 -07:00
isadma.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
memalloc.c [ALSA] Remove unneeded ugly hack for i386 in memalloc.c 2008-05-19 13:19:15 +02:00
memory.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
misc.c [ALSA] sound: this amplifier only goes up to 7 2008-04-24 12:00:35 +02:00
pcm.c [ALSA] PCM interface - rename SNDRV_PCM_TSTAMP_MMAP to SNDRV_PCM_TSTAMP_ENABLE 2008-01-31 17:29:54 +01:00
pcm_compat.c [ALSA] Add SNDRV_PCM_IOCTL_TSTAMP back to compat ioctl 2008-01-31 17:29:36 +01:00
pcm_lib.c [ALSA] PCM interface - rename SNDRV_PCM_TSTAMP_MMAP to SNDRV_PCM_TSTAMP_ENABLE 2008-01-31 17:29:54 +01:00
pcm_memory.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
pcm_misc.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
pcm_native.c snd/PCM: fasync BKL pushdown 2008-07-02 15:06:28 -06:00
pcm_timer.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
rawmidi.c [ALSA] rawmidi: let sparse know what is going on _for real_ 2008-01-31 17:29:49 +01:00
rawmidi_compat.c
rtctimer.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
sgbuf.c [ALSA] use the ALIGN macro 2006-12-20 08:55:36 +01:00
sound.c Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6 2008-07-14 14:48:31 -07:00
sound_oss.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
timer.c ALSA: remove CONFIG_KMOD from sound 2008-07-10 09:32:58 +02:00
timer_compat.c
vmaster.c [ALSA] Keep private TLV entry in vmaster itself 2008-04-24 12:00:12 +02:00