Files
linux/drivers
Tom Rix 034c6afee5 USB: serial: mos7720: improve OOM-handling in read_mos_reg()
commit 161a582bd1 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>
2023-05-16 11:43:25 +09:00
..
2023-05-12 16:27:16 +09:00
2023-05-16 11:26:03 +09:00
2023-05-15 12:46:28 +09:00
2023-05-16 09:58:13 +09:00
2023-05-15 10:37:00 +09:00
2023-05-16 11:35:30 +09:00
2023-05-15 09:23:01 +09:00
2023-05-16 11:42:55 +09:00
2023-05-15 08:28:33 +09:00
2023-05-15 16:59:11 +09:00