aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2008-04-13 17:00:44 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-25 00:16:53 -0400
commitc6dbf554bc8a79c9caab3dbf891a33c19068f646 (patch)
treebe47ae8d24aa2564fd424fecc1ef85e6717dd06d /drivers/usb
parent08177e12b7b4c3d59060f829e5c151d06f9a08d6 (diff)
USB: cdc-acm: signedness fix
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/class/cdc-acm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index d9b408113921..6d57413ac0f5 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -804,7 +804,7 @@ static int acm_probe (struct usb_interface *intf,
804{ 804{
805 struct usb_cdc_union_desc *union_header = NULL; 805 struct usb_cdc_union_desc *union_header = NULL;
806 struct usb_cdc_country_functional_desc *cfd = NULL; 806 struct usb_cdc_country_functional_desc *cfd = NULL;
807 char *buffer = intf->altsetting->extra; 807 unsigned char *buffer = intf->altsetting->extra;
808 int buflen = intf->altsetting->extralen; 808 int buflen = intf->altsetting->extralen;
809 struct usb_interface *control_interface; 809 struct usb_interface *control_interface;
810 struct usb_interface *data_interface; 810 struct usb_interface *data_interface;
@@ -881,9 +881,13 @@ static int acm_probe (struct usb_interface *intf,
881 if ((call_management_function & 3) != 3) 881 if ((call_management_function & 3) != 3)
882 err("This device cannot do calls on its own. It is no modem."); 882 err("This device cannot do calls on its own. It is no modem.");
883 break; 883 break;
884
885 default: 884 default:
886 err("Ignoring extra header, type %d, length %d", buffer[2], buffer[0]); 885 /* there are LOTS more CDC descriptors that
886 * could legitimately be found here.
887 */
888 dev_dbg(&intf->dev, "Ignoring descriptor: "
889 "type %02x, length %d\n",
890 buffer[2], buffer[0]);
887 break; 891 break;
888 } 892 }
889next_desc: 893next_desc: