1
linux/drivers/media/video
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
..
au0828
bt8xx
cpia2
cx18
cx88
cx23885
cx25840
em28xx
et61x251
gspca
ivtv
ovcamchip
pvrusb2
pwc
saa7134
sn9c102
usbvideo
usbvision
uvc
zc0301
adv7170.c
adv7175.c
arv.c
bt819.c
bt856.c
bt866.c
btcx-risc.c
btcx-risc.h
bw-qcam.c
bw-qcam.h
c-qcam.c
cafe_ccic-regs.h
cafe_ccic.c
compat_ioctl32.c
cpia_pp.c
cpia_usb.c
cpia.c
cpia.h
cs53l32a.c
cs5345.c
cs8420.h
cx2341x.c
dabusb.c
dabusb.h
dpc7146.c
font.h
hexium_gemini.c
hexium_orion.c
ibmmpeg2.h
indycam.c
indycam.h
ir-kbd-i2c.c
Kconfig
ks0127.c
ks0127.h
m52790.c
Makefile
meye.c
meye.h
msp3400-driver.c
msp3400-driver.h
msp3400-kthreads.c
mt9m001.c
mt9v022.c
mxb.c
mxb.h
ov511.c
ov511.h
ov7670.c
planb.c
planb.h
pms.c
pxa_camera.c
s2255drv.c
saa711x_regs.h
saa717x.c
saa5246a.c
saa5246a.h
saa5249.c
saa6588.c
saa7110.c
saa7111.c
saa7114.c
saa7115.c
saa7121.h
saa7127.c
saa7146.h
saa7146reg.h
saa7185.c
saa7191.c
saa7191.h
saa7196.h
se401.c
se401.h
sh_mobile_ceu_camera.c
soc_camera_platform.c
soc_camera.c
stk-sensor.c
stk-webcam.c
stk-webcam.h
stradis.c
stv680.c
stv680.h
tcm825x.c
tcm825x.h
tda7432.c
tda9840.c
tda9840.h
tda9875.c
tea6415c.c
tea6415c.h
tea6420.c
tea6420.h
tlv320aic23b.c
tuner-3036.c
tuner-core.c
tvaudio.c
tveeprom.c
tvp5150_reg.h
tvp5150.c
upd64031a.c
upd64083.c
v4l1-compat.c
v4l2-common.c
v4l2-int-device.c
videobuf-core.c
videobuf-dma-contig.c
videobuf-dma-sg.c
videobuf-dvb.c
videobuf-vmalloc.c
videocodec.c
videocodec.h
videodev.c
vino.c
vino.h
vivi.c
vp27smpx.c
vpx3220.c
w9966.c
w9968cf_decoder.h
w9968cf_vpp.h
w9968cf.c
w9968cf.h
wm8739.c
wm8775.c
zoran_card.c
zoran_card.h
zoran_device.c
zoran_device.h
zoran_driver.c
zoran_procfs.c
zoran_procfs.h
zoran.h
zr364xx.c
zr36016.c
zr36016.h
zr36050.c
zr36050.h
zr36057.h
zr36060.c
zr36060.h