Hi,

I spotted the following patch in 2.4.31-pre2-bk4 which didn't seem to
make much sense (apologies for line-wrapping):

diff -Nru a/drivers/usb/serial/io_edgeport.c
b/drivers/usb/serial/io_edgeport.c
--- a/drivers/usb/serial/io_edgeport.c  2004-12-16 05:57:23 -08:00
+++ b/drivers/usb/serial/io_edgeport.c  2005-05-16 06:05:08 -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;
 }

This was backported from 2.6.10 and is apparently to work around a gcc
-Os bug that generates incorrect code without this patch when the
'unicode_size' parameter is negative, leading to an oops.  The original
bug report is here:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=128916

The thing that's puzzling me is why does the workaround not bother
null-terminating the string?

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <[EMAIL PROTECTED]>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to