linux-brain/drivers/usb/serial
Tom Rix 6dec8e17b8 USB: serial: mos7720: improve OOM-handling in read_mos_reg()
commit 161a582bd1d8681095f158d11bc679a58f1d026b upstream.

clang static analysis reports this problem

mos7720.c:352:2: warning: Undefined or garbage value returned to caller
        return d;
        ^~~~~~~~

In the parport_mos7715_read_data()'s call to read_mos_reg(), 'd' is
only set after the alloc block.

	buf = kmalloc(1, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

Although the problem is reported in parport_most7715_read_data(),
none of the callee's of read_mos_reg() check the return status.

Make sure to clear the return-value buffer also on allocation failures.

Fixes: 0d130367ab ("USB: serial: mos7720: fix control-message error handling")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20210111220904.1035957-1-trix@redhat.com
[ johan: only clear the buffer on errors, amend commit message ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-12 08:56:40 +02:00
..
Kconfig
Makefile
Makefile-keyspan_pda_fw
aircable.c
ark3116.c
belkin_sa.c
belkin_sa.h
bus.c
ch341.c Revert "USB: serial: ch341: fix character loss at high transfer rates" 2021-09-03 10:08:13 +02:00
console.c
cp210x.c USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick 2021-07-28 13:31:00 +02:00
cyberjack.c USB: serial: cyberjack: fix write-URB completion race 2020-11-10 12:37:32 +01:00
cypress_m8.c USB: serial: cypress_m8: enable Simply Automated UPB PIM 2020-07-22 09:33:10 +02:00
cypress_m8.h USB: serial: cypress_m8: enable Simply Automated UPB PIM 2020-07-22 09:33:10 +02:00
digi_acceleport.c USB: serial: digi_acceleport: fix write-wakeup deadlocks 2020-12-30 11:51:36 +01:00
empeg.c
ezusb_convert.pl
f81232.c
f81534.c
ftdi_sio.c USB: serial: ftdi_sio: add device ID for Auto-M3 OP-COM v2 2021-08-12 13:20:59 +02:00
ftdi_sio.h
ftdi_sio_ids.h USB: serial: ftdi_sio: add device ID for Auto-M3 OP-COM v2 2021-08-12 13:20:59 +02:00
garmin_gps.c USB: serial: garmin_gps: add sanity checking for data length 2020-05-14 07:58:25 +02:00
generic.c
io_16654.h
io_edgeport.c USB: serial: io_edgeport: fix memory leak in edge_startup 2021-03-17 17:03:50 +01:00
io_edgeport.h
io_ionsp.h
io_ti.c
io_ti.h
io_usbvend.h
ipaq.c
ipw.c
ir-usb.c USB: serial: ir-usb: fix IrLAP framing 2020-02-01 09:34:32 +00:00
iuu_phoenix.c USB: serial: iuu_phoenix: fix DMA from stack 2021-01-12 20:16:19 +01:00
iuu_phoenix.h
keyspan.c USB: serial: keyspan: handle unbound ports 2020-01-23 08:22:34 +01:00
keyspan_pda.c USB: serial: keyspan_pda: remove unused variable 2021-01-12 20:16:21 +01:00
keyspan_usa26msg.h
keyspan_usa28msg.h
keyspan_usa49msg.h
keyspan_usa67msg.h
keyspan_usa90msg.h
kl5kusb105.c USB: serial: kl5kusb105: fix memleak on open 2020-12-11 13:23:27 +01:00
kl5kusb105.h
kobil_sct.c
kobil_sct.h
mct_u232.c
mct_u232.h
metro-usb.c
mos7720.c USB: serial: mos7720: improve OOM-handling in read_mos_reg() 2021-09-12 08:56:40 +02:00
mos7840.c USB: serial: mos7840: fix error code in mos7840_write() 2021-03-04 10:26:42 +01:00
mxuport.c
navman.c
omninet.c USB: serial: omninet: add device id for Zyxel Omni 56K Plus 2021-06-16 11:59:42 +02:00
opticon.c USB: serial: opticon: fix control-message timeouts 2020-01-23 08:22:34 +01:00
option.c USB: serial: option: add new VID/PID to support Fibocom FG150 2021-09-03 10:08:13 +02:00
oti6858.c
oti6858.h
pl2303.c USB: serial: pl2303: add device id for ADLINK ND-6530 GC 2021-06-03 08:59:05 +02:00
pl2303.h USB: serial: pl2303: add device id for ADLINK ND-6530 GC 2021-06-03 08:59:05 +02:00
qcaux.c
qcserial.c USB: serial: qcserial: add EM7305 QDL product ID 2020-08-11 15:33:32 +02:00
quatech2.c USB: serial: quatech2: fix control-request directions 2021-06-16 11:59:42 +02:00
safe_serial.c
sierra.c
spcp8x5.c
ssu100.c
symbolserial.c
ti_usb_3410_5052.c USB: serial: ti_usb_3410_5052: add startech.com device id 2021-06-03 08:59:05 +02:00
upd78f0730.c
usb-serial-simple.c USB: serial: simple: Add Motorola Solutions TETRA MTP3xxx and MTP85xx 2020-01-23 08:22:33 +01:00
usb-serial.c USB: serial: suppress driver bind attributes 2020-01-23 08:22:34 +01:00
usb-wwan.h USB: serial: option: add ZLP support for 0x1bc7/0x9010 2020-01-14 20:08:30 +01:00
usb_debug.c
usb_wwan.c USB: serial: usb_wwan: fix TIOCSSERIAL jiffies conversions 2021-05-14 09:44:10 +02:00
visor.c
visor.h
whiteheat.c USB: serial: whiteheat: fix line-speed endianness 2019-10-30 10:06:32 +01:00
whiteheat.h USB: serial: whiteheat: fix line-speed endianness 2019-10-30 10:06:32 +01:00
wishbone-serial.c
xsens_mt.c