mac80211: ath11k: sync with ath-next
[openwrt/staging/mans0n.git] / package / kernel / mac80211 / patches / ath11k / 0028-wifi-ath11k-ath11k_debugfs_register-fix-format-trunc.patch
1 From a47111663491ff2829df0626493ce81b48dd880a Mon Sep 17 00:00:00 2001
2 From: Kalle Valo <quic_kvalo@quicinc.com>
3 Date: Tue, 10 Oct 2023 09:22:50 +0300
4 Subject: [PATCH] wifi: ath11k: ath11k_debugfs_register(): fix
5 format-truncation warning
6
7 In v6.6-rc4 with GCC 13.2 I see a new warning:
8
9 drivers/net/wireless/ath/ath11k/debugfs.c: In function 'ath11k_debugfs_register':
10 drivers/net/wireless/ath/ath11k/debugfs.c:1597:51: error: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size 2 [-Werror=format-truncation=]
11 drivers/net/wireless/ath/ath11k/debugfs.c:1597:48: note: directive argument in the range [0, 255]
12 drivers/net/wireless/ath/ath11k/debugfs.c:1597:9: note: 'snprintf' output between 5 and 7 bytes into a destination of size 5
13
14 Increase the size of pdev_name to 10 bytes to make sure there's enough room for
15 the string. Also change the format to '%u' as ar->pdev_idx is u8.
16
17 Compile tested only.
18
19 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
20 Link: https://lore.kernel.org/r/20231010062250.2580951-1-kvalo@kernel.org
21 ---
22 drivers/net/wireless/ath/ath11k/debugfs.c | 4 ++--
23 1 file changed, 2 insertions(+), 2 deletions(-)
24
25 --- a/drivers/net/wireless/ath/ath11k/debugfs.c
26 +++ b/drivers/net/wireless/ath/ath11k/debugfs.c
27 @@ -1591,10 +1591,10 @@ static const struct file_operations fops
28 int ath11k_debugfs_register(struct ath11k *ar)
29 {
30 struct ath11k_base *ab = ar->ab;
31 - char pdev_name[5];
32 + char pdev_name[10];
33 char buf[100] = {0};
34
35 - snprintf(pdev_name, sizeof(pdev_name), "%s%d", "mac", ar->pdev_idx);
36 + snprintf(pdev_name, sizeof(pdev_name), "%s%u", "mac", ar->pdev_idx);
37
38 ar->debug.debugfs_pdev = debugfs_create_dir(pdev_name, ab->debugfs_soc);
39 if (IS_ERR(ar->debug.debugfs_pdev))