V4L/DVB (11959): se401: Fix unsafe use of sprintf with identical source/destination
[pandora-kernel.git] / drivers / media / video / se401.c
index d652f25..08129a8 100644 (file)
@@ -932,7 +932,7 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401)
  ***************************************************************************/
 
 
-static int se401_open(struct inode *inode, struct file *file)
+static int se401_open(struct file *file)
 {
        struct video_device *dev = video_devdata(file);
        struct usb_se401 *se401 = (struct usb_se401 *)dev;
@@ -954,7 +954,7 @@ static int se401_open(struct inode *inode, struct file *file)
        return err;
 }
 
-static int se401_close(struct inode *inode, struct file *file)
+static int se401_close(struct file *file)
 {
        struct video_device *dev = file->private_data;
        struct usb_se401 *se401 = (struct usb_se401 *)dev;
@@ -975,7 +975,7 @@ static int se401_close(struct inode *inode, struct file *file)
        return 0;
 }
 
-static int se401_do_ioctl(struct file *file, unsigned int cmd, void *arg)
+static long se401_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 {
        struct video_device *vdev = file->private_data;
        struct usb_se401 *se401 = (struct usb_se401 *)vdev;
@@ -1138,7 +1138,7 @@ static int se401_do_ioctl(struct file *file, unsigned int cmd, void *arg)
        return 0;
 }
 
-static int se401_ioctl(struct inode *inode, struct file *file,
+static long se401_ioctl(struct file *file,
                       unsigned int cmd, unsigned long arg)
 {
        return video_usercopy(file, cmd, arg, se401_do_ioctl);
@@ -1222,17 +1222,13 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma)
        return 0;
 }
 
-static const struct file_operations se401_fops = {
+static const struct v4l2_file_operations se401_fops = {
        .owner =        THIS_MODULE,
        .open =         se401_open,
        .release =      se401_close,
        .read =         se401_read,
        .mmap =         se401_mmap,
        .ioctl =        se401_ioctl,
-#ifdef CONFIG_COMPAT
-       .compat_ioctl = v4l_compat_ioctl32,
-#endif
-       .llseek =       no_llseek,
 };
 static struct video_device se401_template = {
        .name =         "se401 USB camera",
@@ -1248,17 +1244,18 @@ static int se401_init(struct usb_se401 *se401, int button)
        int i=0, rc;
        unsigned char cp[0x40];
        char temp[200];
+       int slen;
 
        /* led on */
        se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
 
        /* get camera descriptor */
        rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp));
-       if (cp[1]!=0x41) {
+       if (cp[1] != 0x41) {
                err("Wrong descriptor type");
                return 1;
        }
-       sprintf (temp, "ExtraFeatures: %d", cp[3]);
+       slen = snprintf(temp, 200, "ExtraFeatures: %d", cp[3]);
 
        se401->sizes=cp[4]+cp[5]*256;
        se401->width=kmalloc(se401->sizes*sizeof(int), GFP_KERNEL);
@@ -1273,9 +1270,10 @@ static int se401_init(struct usb_se401 *se401, int button)
                    se401->width[i]=cp[6+i*4+0]+cp[6+i*4+1]*256;
                    se401->height[i]=cp[6+i*4+2]+cp[6+i*4+3]*256;
        }
-       sprintf (temp, "%s Sizes:", temp);
+       slen += snprintf (temp + slen, 200 - slen, " Sizes:");
        for (i=0; i<se401->sizes; i++) {
-               sprintf(temp, "%s %dx%d", temp, se401->width[i], se401->height[i]);
+               slen += snprintf(temp + slen, 200 - slen,
+                       " %dx%d", se401->width[i], se401->height[i]);
        }
        dev_info(&se401->dev->dev, "%s\n", temp);
        se401->maxframesize=se401->width[se401->sizes-1]*se401->height[se401->sizes-1]*3;