USB: fix oops in io_edgeport.c driver (2.6 backport)

Linux Kernel Mailing List <[email protected]> Mon, 16 May 2005 13:09:10 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1519, 2005/05/16 10:09:10-03:00, [email protected]

	  USB: fix oops in io_edgeport.c driver (2.6 backport)



 io_edgeport.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
--- a/drivers/usb/serial/io_edgeport.c	2005-05-16 12:01:54 -07:00
+++ b/drivers/usb/serial/io_edgeport.c	2005-05-16 12:01:54 -07:00
@@ -2803,9 +2803,13 @@
 static void unicode_to_ascii (char *string, short *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;
 }