# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.640   -> 1.641  
#       drivers/usb/input/hiddev.c      1.17    -> 1.18   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/15      [EMAIL PROTECTED] 1.641
# [PATCH] Reintroduce proper returning of -EFAULT to hiddev.c
# 
# One of my earlier patches backed out a change that fixed all
# copy_to_user calls to properly return -EFAULT if needed. This puts the
# change back in.
# --------------------------------------------
#
diff -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
--- a/drivers/usb/input/hiddev.c        Mon Jul 15 18:05:07 2002
+++ b/drivers/usb/input/hiddev.c        Mon Jul 15 18:05:07 2002
@@ -399,10 +399,12 @@
                dinfo.product = dev->descriptor.idProduct;
                dinfo.version = dev->descriptor.bcdDevice;
                dinfo.num_applications = hid->maxapplication;
-               return copy_to_user((void *) arg, &dinfo, sizeof(dinfo));
+               if (copy_to_user((void *) arg, &dinfo, sizeof(dinfo)))
+                       return -EFAULT;
 
        case HIDIOCGFLAG:
-               return put_user(list->flags, (int *) arg);
+               if (put_user(list->flags, (int *) arg))
+                       return -EFAULT;
 
        case HIDIOCSFLAG:
                {
@@ -488,7 +490,8 @@
 
                rinfo.num_fields = report->maxfield;
 
-               return copy_to_user((void *) arg, &rinfo, sizeof(rinfo));
+               if (copy_to_user((void *) arg, &rinfo, sizeof(rinfo)))
+                       return -EFAULT;
 
        case HIDIOCGFIELDINFO:
                if (copy_from_user(&finfo, (void *) arg, sizeof(finfo)))
@@ -518,7 +521,8 @@
                finfo.unit_exponent = field->unit_exponent;
                finfo.unit = field->unit;
 
-               return copy_to_user((void *) arg, &finfo, sizeof(finfo));
+               if (copy_to_user((void *) arg, &finfo, sizeof(finfo)))
+                       return -EFAULT;
 
        case HIDIOCGUCODE:
                if (copy_from_user(&uref, (void *) arg, sizeof(uref)))
@@ -538,7 +542,8 @@
 
                uref.usage_code = field->usage[uref.usage_index].hid;
 
-               return copy_to_user((void *) arg, &uref, sizeof(uref));
+               if (copy_to_user((void *) arg, &uref, sizeof(uref)))
+                       return -EFAULT;
 
        case HIDIOCGUSAGE:
        case HIDIOCSUSAGE:
@@ -570,7 +575,8 @@
                switch (cmd) {
                        case HIDIOCGUSAGE:
                                uref.value = field->value[uref.usage_index];
-                               return copy_to_user((void *) arg, &uref, sizeof(uref));
+                               if (copy_to_user((void *) arg, &uref, sizeof(uref)))
+                                       return -EFAULT;
                                return 0;
 
                        case HIDIOCSUSAGE:


-------------------------------------------------------
This sf.net email is sponsored by: Jabber - The world's fastest growing 
real-time communications platform! Don't just IM. Build it in! 
http://www.jabber.com/osdn/xim
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to