usb: host: xhci-dbgtty: fix check in dbc_tty_write()
Subsystems (2)
PATCH 1/1 usb: host: xhci-dbgtty: fix check in dbc_tty_write()
The 'int count' parameter of the tty write() method gets assigned to *unsigned long* local variable in the fifo_in() macro which implies a problematic type cast. Fix the 'count' check before the fifo_in() invocation to account for the signed type of the 'count' parameter...
Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
Signed-off-by Sergey Shtylyov <[email protected]>
--- drivers/usb/host/xhci-dbgtty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-dbgtty.c +1 -1
@@ -216,7 +216,7 @@ static int dbc_tty_write(struct tty_struunsigned long flags;spin_lock_irqsave (&port->port_lock, flags); -if (count) +if (count >0 ) count =kfifo_in (&port->write_fifo, buf, count);dbc_start_tx (port);spin_unlock_irqrestore (&port->port_lock, flags);