diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-07-21 18:53:23 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-07-21 18:53:23 -0300 |
commit | 6f683ecd429548ad65c972fa206c7a45c033c478 (patch) | |
tree | 9bfe26c1a25b70ca29e0d180e94b784daac41403 /linux | |
parent | bb7f5a89eeea423828328f3af1b7097c15d60e7e (diff) | |
download | mediapointer-dvb-s2-6f683ecd429548ad65c972fa206c7a45c033c478.tar.gz mediapointer-dvb-s2-6f683ecd429548ad65c972fa206c7a45c033c478.tar.bz2 |
VIDIOCSMICROCODE were missing on compat_ioctl32
From: Mauro Carvalho Chehab <mchehab@infradead.org>
video_code size is 24 on i386 and 32 on x86_64, so a proper handling is needed
on compat_ioctl32 to fix it.
This code should be tested, since just *a few* boards use this ioctl.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/video/compat_ioctl32.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/linux/drivers/media/video/compat_ioctl32.c b/linux/drivers/media/video/compat_ioctl32.c index a84cda06b..0e8c63c18 100644 --- a/linux/drivers/media/video/compat_ioctl32.c +++ b/linux/drivers/media/video/compat_ioctl32.c @@ -492,6 +492,23 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user return 0; } +struct video_code32 +{ + char loadwhat[16]; /* name or tag of file being passed */ + compat_int_t datasize; + unsigned char *data; +}; + +static inline int microcode32(struct video_code *kp, struct video_code32 __user *up) +{ + if(!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || + copy_from_user(kp->loadwhat, up->loadwhat, sizeof (up->loadwhat)) || + get_user(kp->datasize, &up->datasize) || + copy_from_user(kp->data, up->data, up->datasize)) + return -EFAULT; + return 0; +} + #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32) #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32) #define VIDIOCGWIN32 _IOR('v',9, struct video_window32) @@ -500,6 +517,7 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32) #define VIDIOCGFREQ32 _IOR('v',14, u32) #define VIDIOCSFREQ32 _IOW('v',15, u32) +#define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32) /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) @@ -592,6 +610,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg struct video_tuner vt; struct video_buffer vb; struct video_window vw; + struct video_code vc; struct v4l2_format v2f; struct v4l2_buffer v2b; struct v4l2_framebuffer v2fb; @@ -630,6 +649,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; + case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; }; switch(cmd) { @@ -705,6 +725,10 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg case VIDIOC_G_FBUF: case VIDIOC_G_INPUT: compatible_arg = 0; + case VIDIOCSMICROCODE: + err = microcode32(&karg.vc, up); + compatible_arg = 0; + break; }; if(err) |