linux-stable/drivers/usb
Dan Carpenter ebd7bc419a usb: fotg210-hcd: delete an incorrect bounds test
commit 7fbcd195e2 upstream.

Here "temp" is the number of characters that we have written and "size"
is the size of the buffer.  The intent was clearly to say that if we have
written to the end of the buffer then stop.

However, for that to work the comparison should have been done on the
original "size" value instead of the "size -= temp" value.  Not only
will that not trigger when we want to, but there is a small chance that
it will trigger incorrectly before we want it to and we break from the
loop slightly earlier than intended.

This code was recently changed from using snprintf() to scnprintf().  With
snprintf() we likely would have continued looping and passed a negative
size parameter to snprintf().  This would have triggered an annoying
WARN().  Now that we have converted to scnprintf() "size" will never
drop below 1 and there is no real need for this test.  We could change
the condition to "if (temp <= 1) goto done;" but just deleting the test
is cleanest.

Fixes: 7d50195f6c ("usb: host: Faraday fotg210-hcd driver")
Cc: stable <stable@kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/ZXmwIwHe35wGfgzu@suswa
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-01 12:42:41 +00:00
..
atm
c67x00 usb: c67x00-drv: Convert to platform remove callback returning void 2023-05-28 12:36:14 +01:00
cdns3 usb: cdnsp: Fix deadlock issue during using NCM gadget 2023-12-03 07:33:09 +01:00
chipidea usb: chipidea: Simplify Tegra DMA alignment code 2023-11-20 11:59:26 +01:00
class TTY/Serial driver changes for 6.6-rc1 2023-09-01 09:38:00 -07:00
common Merge 6.5-rc6 into usb-next 2023-08-14 22:22:31 +02:00
core usb: config: fix iteration issue in 'usb_get_bos_descriptor()' 2023-12-03 07:33:09 +01:00
dwc2 USB: dwc2: write HCINT with INTMASK applied 2023-12-03 07:33:10 +01:00
dwc3 USB: dwc3: qcom: fix wakeup after probe deferral 2023-12-03 07:33:10 +01:00
early
fotg210 usb: fotg210-hcd: delete an incorrect bounds test 2024-01-01 12:42:41 +00:00
gadget USB: gadget: core: adjust uevent timing on gadget unbind 2023-12-13 18:45:33 +01:00
host Revert "xhci: Loosen RPM as default policy to cover for AMD xHC 1.1" 2023-12-13 18:45:32 +01:00
image scsi: usb: uas: Declare two host templates and host template pointers const 2023-03-24 19:20:00 -04:00
isp1760 usb: isp1760: Convert to platform remove callback returning void 2023-05-28 12:38:01 +01:00
misc usb: misc: onboard-hub: add support for Microchip USB5744 2023-12-03 07:33:08 +01:00
mon USB: mon: make mon_bin_class a static const structure 2023-06-20 16:20:45 +02:00
mtu3 usb: Explicitly include correct DT includes 2023-07-25 18:20:02 +02:00
musb usb: musb: Get the musb_qh poniter after musb_giveback 2023-10-02 13:37:57 +02:00
phy usb: phy: mxs: disconnect line when USB charger is attached 2023-07-25 18:24:17 +02:00
renesas_usbhs usb: Explicitly include correct DT includes 2023-07-25 18:20:02 +02:00
roles USB: roles: make role_class a static const structure 2023-06-20 16:20:40 +02:00
serial USB: serial: option: add Quectel RM500Q R13 firmware support 2024-01-01 12:42:39 +00:00
storage usb-storage: Add quirk for incorrect WP on Kingston DT Ultimate 3.0 G3 2024-01-01 12:42:38 +00:00
typec usb: typec: ucsi: fix gpio-based orientation detection 2024-01-01 12:42:41 +00:00
usbip USB: usbip: fix stub_dev hub disconnect 2023-11-20 11:59:26 +01:00
Kconfig usb: move config USB_USS720 to usb's misc Kconfig 2023-03-29 10:34:08 +02:00
Makefile usb: host: u132-hcd: Delete driver 2023-03-21 14:06:11 +01:00
usb-skeleton.c