bianbu-linux-6.6/drivers/net/wireless/ath/ath9k
Dmitry Antipov 8954a159d1 wifi: ath9k: fix clang-specific fortify warnings
[ Upstream commit 95f97fe0ac974467ab4da215985a32b2fdf48af0 ]

When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=y, I've
noticed the following (somewhat confusing due to absence of an actual
source code location):

In file included from drivers/net/wireless/ath/ath9k/debug.c:17:
In file included from ./include/linux/slab.h:16:
In file included from ./include/linux/gfp.h:7:
In file included from ./include/linux/mmzone.h:8:
In file included from ./include/linux/spinlock.h:56:
In file included from ./include/linux/preempt.h:79:
In file included from ./arch/x86/include/asm/preempt.h:9:
In file included from ./include/linux/thread_info.h:60:
In file included from ./arch/x86/include/asm/thread_info.h:53:
In file included from ./arch/x86/include/asm/cpufeature.h:5:
In file included from ./arch/x86/include/asm/processor.h:23:
In file included from ./arch/x86/include/asm/msr.h:11:
In file included from ./arch/x86/include/asm/cpumask.h:5:
In file included from ./include/linux/cpumask.h:12:
In file included from ./include/linux/bitmap.h:11:
In file included from ./include/linux/string.h:254:
./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
declared with 'warning' attribute: detected read beyond size of field (2nd
parameter); maybe use struct_group()? [-Wattribute-warning]
                        __read_overflow2_field(q_size_field, size);

In file included from drivers/net/wireless/ath/ath9k/htc_drv_debug.c:17:
In file included from drivers/net/wireless/ath/ath9k/htc.h:20:
In file included from ./include/linux/module.h:13:
In file included from ./include/linux/stat.h:19:
In file included from ./include/linux/time.h:60:
In file included from ./include/linux/time32.h:13:
In file included from ./include/linux/timex.h:67:
In file included from ./arch/x86/include/asm/timex.h:5:
In file included from ./arch/x86/include/asm/processor.h:23:
In file included from ./arch/x86/include/asm/msr.h:11:
In file included from ./arch/x86/include/asm/cpumask.h:5:
In file included from ./include/linux/cpumask.h:12:
In file included from ./include/linux/bitmap.h:11:
In file included from ./include/linux/string.h:254:
./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
declared with 'warning' attribute: detected read beyond size of field (2nd
parameter); maybe use struct_group()? [-Wattribute-warning]
                        __read_overflow2_field(q_size_field, size);

The compiler actually complains on 'ath9k_get_et_strings()' and
'ath9k_htc_get_et_strings()' due to the same reason: fortification logic
inteprets call to 'memcpy()' as an attempt to copy the whole array from
it's first member and so issues an overread warning. These warnings may
be silenced by passing an address of the whole array and not the first
member to 'memcpy()'.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230829093856.234584-1-dmantipov@yandex.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-28 17:19:37 +00:00
..
ahb.c wifi: ath9k: fix printk specifier 2023-07-25 17:31:37 +03:00
ani.c
ani.h
antenna.c
ar953x_initvals.h
ar955x_1p0_initvals.h
ar956x_initvals.h
ar5008_initvals.h
ar5008_phy.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9001_initvals.h
ar9002_calib.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9002_hw.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9002_initvals.h
ar9002_mac.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9002_phy.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9002_phy.h
ar9003_2p2_initvals.h
ar9003_aic.c
ar9003_aic.h
ar9003_buffalo_initvals.h
ar9003_calib.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9003_eeprom.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9003_eeprom.h wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9003_hw.c wifi: ath9k: fix AR9003 mac hardware hang check register offset calculation 2023-04-28 19:51:31 +03:00
ar9003_mac.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9003_mac.h
ar9003_mci.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9003_mci.h
ar9003_paprd.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9003_phy.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9003_phy.h wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9003_rtt.c
ar9003_rtt.h
ar9003_wow.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
ar9330_1p1_initvals.h
ar9330_1p2_initvals.h
ar9340_initvals.h
ar9462_2p0_initvals.h
ar9462_2p1_initvals.h
ar9485_initvals.h
ar9565_1p0_initvals.h
ar9565_1p1_initvals.h
ar9580_1p0_initvals.h
ath9k.h wifi: ath9k: Remove unused declarations 2023-08-22 16:39:23 +03:00
ath9k_pci_owl_loader.c ath9k: owl-loader: fetch pci init values through nvmem 2021-09-16 11:07:41 +03:00
beacon.c wifi: mac80211: return a beacon for a specific link 2022-06-20 12:57:08 +02:00
btcoex.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
btcoex.h
calib.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
calib.h
channel.c wifi: mac80211: extend ieee80211_nullfunc_get() for MLO 2022-09-06 10:14:24 +02:00
common-beacon.c
common-beacon.h
common-debug.c
common-debug.h
common-init.c
common-init.h
common-spectral.c wifi: ath9k: consistently use kstrtoX_from_user() functions 2023-08-22 16:37:53 +03:00
common-spectral.h
common.c
common.h wifi: ath9k: Remove unused declarations 2023-08-22 16:39:23 +03:00
debug.c wifi: ath9k: fix clang-specific fortify warnings 2023-11-28 17:19:37 +00:00
debug.h ath9k: add option to reset the wifi chip via debugfs 2021-10-05 17:27:31 +03:00
debug_sta.c mac80211: prepare sta handling for MLO support 2022-04-11 16:42:03 +02:00
dfs.c ath9k: replace ternary operator with max() 2022-05-22 15:31:18 +03:00
dfs.h
dfs_debug.c wifi: ath9k: consistently use kstrtoX_from_user() functions 2023-08-22 16:37:53 +03:00
dfs_debug.h
dynack.c
dynack.h
eeprom.c ath9k: remove redundant status variable 2022-01-17 14:43:02 +02:00
eeprom.h wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
eeprom_4k.c
eeprom_9287.c wifi: ath9k: Remove unnecessary ternary operators 2023-08-22 16:38:40 +03:00
eeprom_def.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
gpio.c
hif_usb.c wifi: ath9k: Remove unnecessary ternary operators 2023-08-22 16:38:40 +03:00
hif_usb.h
htc.h wifi: ath9k: use proper statements in conditionals 2022-12-20 15:02:37 +02:00
htc_drv_beacon.c wifi: mac80211: return a beacon for a specific link 2022-06-20 12:57:08 +02:00
htc_drv_debug.c wifi: ath9k: fix clang-specific fortify warnings 2023-11-28 17:19:37 +00:00
htc_drv_gpio.c
htc_drv_init.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
htc_drv_main.c wifi: ath: remove unused-but-set parameter 2023-08-23 17:12:09 +03:00
htc_drv_txrx.c ath9k: htc: clean up statistics macros 2022-06-20 13:02:17 +03:00
htc_hst.c wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes 2023-05-25 20:04:32 +03:00
htc_hst.h
hw-ops.h
hw.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
hw.h wifi: ath9k: fix repeated to words in a comment 2022-09-22 10:19:51 +03:00
init.c ath9k: fix an IS_ERR() vs NULL check 2021-10-13 08:48:14 +03:00
Kconfig
link.c
mac.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
mac.h wifi: ath9k: fix fortify warnings 2023-07-25 17:28:03 +03:00
main.c wifi: ath: remove unused-but-set parameter 2023-08-23 17:12:09 +03:00
Makefile wifi: ath9k: Remove -Warray-bounds exception 2022-10-11 07:39:11 +03:00
mci.c wifi: ath9k: Don't mark channelmap stack variable read-only in ath9k_mci_update_wlan_channels() 2023-04-19 17:24:47 +03:00
mci.h
pci.c wifi: ath9k: fix printk specifier 2023-07-25 17:31:37 +03:00
phy.h
recv.c
reg.h wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
reg_aic.h
reg_mci.h
reg_wow.h
rng.c wifi: ath9k: remove most hidden macro dependencies on ah 2022-12-22 19:13:39 +02:00
tx99.c wifi: ath9k: consistently use kstrtoX_from_user() functions 2023-08-22 16:37:53 +03:00
wmi.c wifi: ath9k: protect WMI command response buffer replacement with a lock 2023-08-22 16:35:17 +03:00
wmi.h
wow.c
xmit.c wifi: ath9k: fix fortify warnings 2023-07-25 17:28:03 +03:00