* [PATCH] usb: host: xhci-dbgtty: fix check in dbc_tty_write()
@ 2022-03-02 21:03 Sergey Shtylyov
0 siblings, 0 replies; only message in thread
From: Sergey Shtylyov @ 2022-03-02 21:03 UTC (permalink / raw)
To: Mathias Nyman, linux-usb, Greg Kroah-Hartman
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 <s.shtylyov@omp.ru>
---
drivers/usb/host/xhci-dbgtty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: usb/drivers/usb/host/xhci-dbgtty.c
===================================================================
--- usb.orig/drivers/usb/host/xhci-dbgtty.c
+++ usb/drivers/usb/host/xhci-dbgtty.c
@@ -216,7 +216,7 @@ static int dbc_tty_write(struct tty_stru
unsigned 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-02 21:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 21:03 [PATCH] usb: host: xhci-dbgtty: fix check in dbc_tty_write() Sergey Shtylyov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.