patch "USB: serial: ch341: fix type promotion bug in ch341_control_in()" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
USB: serial: ch341: fix type promotion bug in ch341_control_in()
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
e33eab9ded328ccc14308afa51b5be7cbe78d30bMon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Wed, 4 Jul 2018 12:29:38 +0300
Subject: USB: serial: ch341: fix type promotion bug in ch341_control_in()
The "r" variable is an int and "bufsize" is an unsigned int so the comparison is type promoted to unsigned. If usb_control_msg() returns a negative that is treated as a high positive value and the error handling doesn't work.
--- drivers/usb/serial/ch341.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/ch341.c +1 -1
@@ -128,7 +128,7 @@ static int ch341_control_in(struct usb_device *dev, r =usb_control_msg (dev,usb_rcvctrlpipe (dev,0 ), request,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_IN , value, index, buf, bufsize,DEFAULT_TIMEOUT ); -if (r < bufsize) { +if (r < (int )bufsize) {if (r >=0 ) { dev_err(&dev->dev, "short control message received (%d < %u)\n",
Signature · 1 line
2.18.0