]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
USB: cdc-acm: signedness fix
authorDavid Brownell <david-b@pacbell.net>
Sun, 13 Apr 2008 21:00:44 +0000 (14:00 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Apr 2008 04:16:53 +0000 (21:16 -0700)
Fix bogus assignment of "unsigned char *" to "char *":  preserve
unsignedness.  These values are used directly as descriptor lengths
when iterating through the buffer, so this *could* cause oddness
that potentially includes oopsing.  (IMO not likely, except as
part of a malicious device...)

Fix the bogus warning in CDC ACM which highlighted this problem
(by showing a negative descriptor type).  It uses the undesirable
legacy err() for something that's not even an error; switch to
use dev_dbg, and show descriptor types in hex notation to match
the convention for such codes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/class/cdc-acm.c

index d9b40811392179c717076f0404293ff0c5386f14..6d57413ac0f5de80278e13c31ae0896889c15166 100644 (file)
@@ -804,7 +804,7 @@ static int acm_probe (struct usb_interface *intf,
 {
        struct usb_cdc_union_desc *union_header = NULL;
        struct usb_cdc_country_functional_desc *cfd = NULL;
-       char *buffer = intf->altsetting->extra;
+       unsigned char *buffer = intf->altsetting->extra;
        int buflen = intf->altsetting->extralen;
        struct usb_interface *control_interface;
        struct usb_interface *data_interface;
@@ -881,9 +881,13 @@ static int acm_probe (struct usb_interface *intf,
                                if ((call_management_function & 3) != 3)
                                        err("This device cannot do calls on its own. It is no modem.");
                                break;
-                               
                        default:
-                               err("Ignoring extra header, type %d, length %d", buffer[2], buffer[0]);
+                               /* there are LOTS more CDC descriptors that
+                                * could legitimately be found here.
+                                */
+                               dev_dbg(&intf->dev, "Ignoring descriptor: "
+                                               "type %02x, length %d\n",
+                                               buffer[2], buffer[0]);
                                break;
                        }
 next_desc: