linux/drivers/staging/rtl8188eu
Arnd Bergmann c7472b964d staging: rtl: fix possible NULL pointer dereference
commit 6e01700602 upstream.

gcc-7 detects that wlanhdr_to_ethhdr() in two drivers calls memcpy() with
a destination argument that an earlier function call may have set to NULL:

staging/rtl8188eu/core/rtw_recv.c: In function 'wlanhdr_to_ethhdr':
staging/rtl8188eu/core/rtw_recv.c:1318:2: warning: argument 1 null where non-null expected [-Wnonnull]
staging/rtl8712/rtl871x_recv.c: In function 'r8712_wlanhdr_to_ethhdr':
staging/rtl8712/rtl871x_recv.c:649:2: warning: argument 1 null where non-null expected [-Wnonnull]

I'm fixing this by adding a NULL pointer check and returning failure
from the function, which is hopefully already handled properly.

This seems to date back to when the drivers were originally added,
so backporting the fix to stable seems appropriate. There are other
related realtek drivers in the kernel, but none of them contain a
function with a similar name or produce this warning.

Fixes: 1cc18a22b9 ("staging: r8188eu: Add files for new driver - part 5")
Fixes: 2865d42c78 ("staging: r8712u: Add the new driver to the mainline kernel")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2017-03-12 06:41:42 +01:00
..
core staging: rtl: fix possible NULL pointer dereference 2017-03-12 06:41:42 +01:00
hal staging:r8188eu: change rtl8188e_process_phy_info function argument type 2016-10-02 17:31:15 +02:00
include staging:r8188eu: remove GEN_MLME_EXT_HANDLER macro 2016-10-02 17:31:16 +02:00
os_dep staging: rtl8188eu: fix double unlock error in rtw_resume_process() 2016-10-02 17:32:17 +02:00
Kconfig staging: rtl8188eu: Fix build error when CFG80211 is not selected 2015-09-29 04:27:22 +02:00
Makefile staging: rtl8188eu: provide an absolute path to include folder 2016-02-07 19:00:46 -08:00
TODO staging: rtl8*: fix my email address up 2016-02-11 19:33:46 -08:00