>From 2.4.23 (same thing with 2.6.0-test11):

struct iso_packet_descriptor
{
        unsigned int offset;
        unsigned int length;            // expected length
        unsigned int actual_length;
        unsigned int status;
};

where status is used for storing Linux error code. However, since the
errorcodes are negative, status should be (as far as I can understand)
signed, not unsigned. Patches to fix 2.4.23 and 2.6.0-test11 attached.

A practical example of consequences with unsigned problems:
some functions return positive value to denote success, so I have uniformly
tested only for negative values to be errors:
        struct iso_packet_descriptor *ipd = ...
        if (ipd->status < 0) { goto error; }
and since this test is never true, it caused some oopses in my driver.

I wonder why gcc (2.95.4) didn't give a warning.
--- linux-2.4.23/include/linux/usb.h.orig       Sat Dec  6 00:29:46 2003
+++ linux-2.4.23/include/linux/usb.h    Tue Dec 16 00:31:24 2003
@@ -489,7 +489,7 @@
        unsigned int offset;
        unsigned int length;            // expected length
        unsigned int actual_length;
-       unsigned int status;
+       int status;
 };
 
 #define usb_iso_packet_descriptor      iso_packet_descriptor
--- linux-2.6.0-test11/include/linux/usb.h.orig Fri Dec  5 19:26:38 2003
+++ linux-2.6.0-test11/include/linux/usb.h      Tue Dec 16 00:29:49 2003
@@ -513,7 +513,7 @@
        unsigned int offset;
        unsigned int length;            /* expected length */
        unsigned int actual_length;
-       unsigned int status;
+       int status;
 };
 
 struct urb;

Reply via email to