diff options
author | Rui Miguel Silva <rui.silva@linaro.org> | 2021-08-19 19:09:26 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-08-26 13:30:39 +0200 |
commit | 8e58b7710d6634ed46ae26fedb8459f84f08fd51 (patch) | |
tree | a9890bd2aa502841125eee3a3261262bdd390384 /drivers/usb | |
parent | 8472896f39cfab2d8fec9ca746070aaf02609169 (diff) | |
download | linux-8e58b7710d6634ed46ae26fedb8459f84f08fd51.tar.bz2 |
usb: isp1760: check maxpacketsize before using it
When checking if we need one more packet on a bulk pipe we may, even
though not probable at all, get there with a zero maxpacketsize.
In that case for sure no packet, no even a one more, will be
allocated.
This will clean the clang-analyzer warning:
drivers/usb/isp1760/isp1760-hcd.c:1856:38: warning: Division by zero [clang-analyzer-core.DivideZero]
&& !(urb->transfer_buffer_length %
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/20210819180929.1327349-3-rui.silva@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/isp1760/isp1760-hcd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index 2a21fe5aa7a8..5c947a1eae49 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -1854,7 +1854,7 @@ static void packetize_urb(struct usb_hcd *hcd, packet_type = OUT_PID; else packet_type = IN_PID; - } else if (usb_pipebulk(urb->pipe) + } else if (usb_pipebulk(urb->pipe) && maxpacketsize && (urb->transfer_flags & URB_ZERO_PACKET) && !(urb->transfer_buffer_length % maxpacketsize)) { |