staging: comedi: check return code of put_user
authorVasiliy Kulikov <segooon@gmail.com>
Sun, 5 Sep 2010 18:32:33 +0000 (22:32 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 5 Sep 2010 23:59:51 +0000 (16:59 -0700)
Function put_user may fail. Check for it.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/comedi/comedi_fops.c

index 14091313cebbe66c419b73453ccd0b158d89c1da..98fa255d862ef9f7e3257ad3eaadfd4fb1053374 100644 (file)
@@ -537,7 +537,8 @@ static int do_chaninfo_ioctl(struct comedi_device *dev,
 
                        x = (dev->minor << 28) | (it.subdev << 24) | (i << 16) |
                            (s->range_table_list[i]->length);
-                       put_user(x, it.rangelist + i);
+                       if (put_user(x, it.rangelist + i))
+                               return -EFAULT;
                }
 #if 0
                if (copy_to_user(it.rangelist, s->range_type_list,