]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] USB: fix oops in io_edgeport.c driver
authorGreg Kroah-Hartman <greg@kroah.com>
Mon, 29 Nov 2004 03:42:17 +0000 (19:42 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 29 Nov 2004 03:42:17 +0000 (19:42 -0800)
This fixes https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=128916

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/usb/serial/io_edgeport.c

index 401b95cabf2a0bcc7f76f9d70741bb5680c38d13..010160ed1f409a8ac8d1aea727aa287a562c100d 100644 (file)
@@ -2797,9 +2797,12 @@ static void change_port_settings (struct edgeport_port *edge_port, struct termio
 static void unicode_to_ascii (char *string, __le16 *unicode, int unicode_size)
 {
        int i;
-       for (i = 0; i < unicode_size; ++i) {
+
+       if (unicode_size <= 0)
+               return;
+
+       for (i = 0; i < unicode_size; ++i)
                string[i] = (char)(le16_to_cpu(unicode[i]));
-       }
        string[unicode_size] = 0x00;
 }