staging: rtl8188eu: fix null dereference when kzalloc fails
authorConnor Kuehl <connor.kuehl@canonical.com>
Fri, 27 Sep 2019 21:44:15 +0000 (14:44 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Nov 2019 12:05:45 +0000 (13:05 +0100)
commitdfc1daba843b4dece22a0bcf6cfa173b88f0b731
tree2a5e2eb88c1ad78b23a1a0278bbf6aba9c97dc82
parent3545c018d0c3ff91a3b1bbf29c11a520a38d44f1
staging: rtl8188eu: fix null dereference when kzalloc fails

[ Upstream commit 955c1532a34305f2f780b47f0c40cc7c65500810 ]

If kzalloc() returns NULL, the error path doesn't stop the flow of
control from entering rtw_hal_read_chip_version() which dereferences the
null pointer. Fix this by adding a 'goto' to the error path to more
gracefully handle the issue and avoid proceeding with initialization
steps that we're no longer prepared to handle.

Also update the debug message to be more consistent with the other debug
messages in this function.

Addresses-Coverity: ("Dereference after null check")

Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Link: https://lore.kernel.org/r/20190927214415.899-1-connor.kuehl@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/rtl8188eu/os_dep/usb_intf.c