diff options
author | Sergey Shtylyov <s.shtylyov@omp.ru> | 2022-02-17 18:30:13 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-02-24 11:19:18 +0100 |
commit | c6c986b657e55910746ea0f41e1aee0696833c7a (patch) | |
tree | 85393a3de8d96224cb0ec0fbf2c9e972858c2aea | |
parent | usb: dwc3: pci: Also apply Bay Trail GPIO mappings to ulpi-device (diff) | |
download | linux-c6c986b657e55910746ea0f41e1aee0696833c7a.tar.xz linux-c6c986b657e55910746ea0f41e1aee0696833c7a.zip |
usb: host: ehci-q: make qtd_fill() return *unsigned int*
At the end of qtd_fill(), we assign the 'int count' variable to the 'size_t
length' field of 'struct ehci_qtd' -- which implies a problematic type cast.
Let's make that variable and the function's result *unsigned int* instead...
Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Link: https://lore.kernel.org/r/8c64fdeb-5857-8cb3-cfd8-0c248a14b909@omp.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/ehci-q.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 2cbf4f85bff3..a2a5c2996350 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c @@ -33,12 +33,13 @@ /* fill a qtd, returning how much of the buffer we were able to queue up */ -static int +static unsigned int qtd_fill(struct ehci_hcd *ehci, struct ehci_qtd *qtd, dma_addr_t buf, size_t len, int token, int maxpacket) { - int i, count; + unsigned int count; u64 addr = buf; + int i; /* one buffer entry per 4K ... first might be short or unaligned */ qtd->hw_buf[0] = cpu_to_hc32(ehci, (u32)addr); @@ -652,7 +653,7 @@ qh_urb_transaction ( * and may serve as a control status ack */ for (;;) { - int this_qtd_len; + unsigned int this_qtd_len; this_qtd_len = qtd_fill(ehci, qtd, buf, this_sg_len, token, maxpacket); |