linux-stable/drivers/staging
Larry Finger 9c8fc4b323 staging: r8188eu: Fix warning of array overflow in ioctl_linux.c
[ Upstream commit 96f0a54e8e ]

Building with -Warray-bounds results in the following warning plus others
related to the same problem:

CC [M]  drivers/staging/r8188eu/os_dep/ioctl_linux.o
In function ‘wpa_set_encryption’,
    inlined from ‘rtw_wx_set_enc_ext’ at drivers/staging/r8188eu/os_dep/ioctl_linux.c:1868:9:
drivers/staging/r8188eu/os_dep/ioctl_linux.c:412:41: warning: array subscript ‘struct ndis_802_11_wep[0]’ is partly outside array bounds of ‘void[25]’ [-Warray-bounds]
  412 |                         pwep->KeyLength = wep_key_len;
      |                         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from drivers/staging/r8188eu/os_dep/../include/osdep_service.h:19,
                 from drivers/staging/r8188eu/os_dep/ioctl_linux.c:4:
In function ‘kmalloc’,
    inlined from ‘kzalloc’ at ./include/linux/slab.h:733:9,
    inlined from ‘wpa_set_encryption’ at drivers/staging/r8188eu/os_dep/ioctl_linux.c:408:11,
    inlined from ‘rtw_wx_set_enc_ext’ at drivers/staging/r8188eu/os_dep/ioctl_linux.c:1868:9:
./include/linux/slab.h:605:16: note: object of size [17, 25] allocated by ‘__kmalloc’
  605 |         return __kmalloc(size, flags);
      |                ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/slab.h:600:24: note: object of size [17, 25] allocated by ‘kmem_cache_alloc_trace’
  600 |                 return kmem_cache_alloc_trace(
      |                        ^~~~~~~~~~~~~~~~~~~~~~~
  601 |                                 kmalloc_caches[kmalloc_type(flags)][index],
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  602 |                                 flags, size);
      |                                 ~~~~~~~~~~~~

Although it is unlikely that anyone is still using WEP encryption, the
size of the allocation needs to be increased just in case.

Fixes commit 2b42bd58b3 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver")

Fixes: 2b42bd58b3 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver")
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Phillip Potter <phil@philpotter.co.uk>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220531013103.2175-3-Larry.Finger@lwfinger.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-22 14:21:59 +02:00
..
android
axis-fifo
board
clocking-wizard
emxx_udc
fbtft
fieldbus staging: fieldbus: Fix the error handling path in anybuss_host_common_probe() 2022-06-14 18:36:04 +02:00
fwserial
gdm724x
greybus staging: greybus: codecs: fix type confusion of list iterator variable 2022-06-14 18:36:02 +02:00
gs_fpgaboot
iio staging:iio:adc:ad7280a: Fix handing of device address bit reversing. 2022-04-08 14:23:45 +02:00
ks7010
media media: rkvdec: h264: Fix bit depth wrap in pps packet 2022-06-09 10:22:59 +02:00
most
mt7621-dma
mt7621-dts staging: mt7621-dts: fix pinctrl-0 items to be size-1 items on ethernet 2022-04-08 14:24:13 +02:00
mt7621-pci
netlogic
nvec
octeon
octeon-usb
olpc_dcon
pi433
qlge
r8188eu staging: r8188eu: Fix warning of array overflow in ioctl_linux.c 2022-06-22 14:21:59 +02:00
ralink-gdma
rtl8192e drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop() 2022-06-14 18:36:20 +02:00
rtl8192u drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop() 2022-06-14 18:36:20 +02:00
rtl8712 staging: rtl8712: fix uninit-value in r871xu_drv_init() 2022-06-14 18:36:22 +02:00
rtl8723bs drivers: staging: rtl8192bs: Fix deadlock in rtw_joinbss_event_prehandle() 2022-06-14 18:36:20 +02:00
rts5208
sm750fb
unisys
vc04_services staging: vchiq_core: handle NULL result of find_service_by_handle 2022-04-13 20:59:11 +02:00
vme
vt6655
vt6656
wfx staging: wfx: fix an error handling in wfx_init_common() 2022-04-13 20:59:11 +02:00
wlan-ng
Kconfig
Makefile