linux/drivers/staging
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
..
android staging: android: ion: Fix error handling in ion_query_heaps() 2016-10-24 15:36:15 +02:00
board staging: board: Remove calls to of_genpd_get_from_provider() 2016-09-13 02:49:33 +02:00
clocking-wizard Staging: clocking-wizard: CHECK:Please use a blank line 2016-02-07 20:05:31 -08:00
comedi staging: comedi: ni_mio_common: fix E series ni_ai_insn_read() data 2017-01-09 08:32:18 +01:00
dgnc staging: dgnc: Fix lines longer than 80 characters 2016-10-02 17:24:00 +02:00
emxx_udc staging: emxx_udc: add braces to if-else block 2016-09-16 10:10:34 +02:00
fbtft Staging: fbtft: Fix bug in fbtft-core 2016-10-02 19:51:05 +02:00
fsl-mc Staging/IIO patches for 4.9-rc1 2016-10-05 14:50:51 -07:00
fwserial staging: fwserial: fix checkpatch permission warnings 2016-09-13 15:44:46 +02:00
gdm724x staging: gdm724x: Remove unnecessary blank line 2016-09-16 10:10:34 +02:00
goldfish staging: goldfish: audio: fix compiliation on arm 2016-03-11 22:09:09 -08:00
greybus staging: greybus: loopback: fix broken udelay 2017-03-12 06:41:42 +01:00
gs_fpgaboot staging: gs_fpgaboot: Remove FSF address from GPL notice 2016-09-16 10:10:34 +02:00
i4l staging: i4l: act2000: Move assignment out of if statement 2016-09-20 13:46:32 +02:00
iio staging: iio: ad7606: fix improper setting of oversampling pins 2017-01-12 11:39:21 +01:00
ks7010 Staging : ks7010 : Fix block comments warninig 2016-10-02 17:29:11 +02:00
lustre staging/lustre/lnet: Fix allocation size for sv_cpt_data 2017-03-12 06:41:42 +01:00
media s5p-cec: mark PM functions as __maybe_unused again 2017-01-26 08:24:45 +01:00
most Staging: most: hdm-dim2: constify attribute_group structures 2016-10-02 17:24:00 +02:00
mt29f_spinand staging: mt29f_spinand: set ECC algorithm explicitly 2016-05-05 23:52:04 +02:00
netlogic Staging: netlogic: Remove unused function 2016-09-16 10:10:34 +02:00
nvec staging: nvec: remove managed resource from PS2 driver 2016-11-07 11:48:25 +01:00
octeon staging: octeon: Call SET_NETDEV_DEV() 2017-01-12 11:39:05 +01:00
octeon-usb staging: octeon-usb: Remove unnecessary assignment 2016-09-22 11:54:48 +02:00
olpc_dcon Revert "staging: olpc_dcon: Replace a bit shift by a use of BIT." 2016-09-18 13:09:50 +02:00
rtl8188eu staging: rtl: fix possible NULL pointer dereference 2017-03-12 06:41:42 +01:00
rtl8192e staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants 2016-10-02 17:26:57 +02:00
rtl8192u staging: rtl8192u: remove unused functions in r8192U_core.c 2016-09-23 19:00:44 +02:00
rtl8712 staging: rtl: fix possible NULL pointer dereference 2017-03-12 06:41:42 +01:00
rts5208 Staging: rts5208: Fix indentation warnings 2016-10-02 17:14:03 +02:00
skein staging: skein: cleanup: align code to parentheses 2016-05-03 14:07:11 -07:00
slicoss staging: slicoss: cleaning up codestyle warnings 2016-09-27 13:08:04 +02:00
sm750fb staging: sm750fb: Fix bugs introduced by early commits 2016-11-07 10:27:40 +01:00
speakup Staging: speakup: constify attribute_group structures 2016-10-02 17:14:03 +02:00
unisys staging: unisys: visorbus: fix typos with client_bus_info /sys entry 2016-09-28 11:30:52 +02:00
vc04_services mm: replace get_user_pages() write/force parameters with gup_flags 2016-10-19 08:11:43 -07:00
vme drivers: staging: vme: convert to octal notation for permission bits 2016-09-17 23:36:53 +02:00
vt6655 Staging: vt6655: Remove explicit NULL comparison using Coccinelle 2016-10-02 17:29:11 +02:00
vt6656 staging: vt6656: Remove unused variable 'rx_sts' 2016-09-28 11:35:52 +02:00
wilc1000 Staging: wilc1000: Fix kernel Oops on opening the device 2016-10-17 09:14:55 +02:00
wlan-ng staging: wlang-ng: Fix block comments style warnings in hfa384x.h 2016-10-02 17:06:21 +02:00
xgifb staging: xgifb: Remove unused variable and if statement 2016-09-22 11:54:47 +02:00
Kconfig staging: add bcm2708 vchiq driver 2016-10-02 15:40:04 +02:00
Makefile staging: add bcm2708 vchiq driver 2016-10-02 15:40:04 +02:00