Search Linux Wireless

Re: [PATCH] wifi: ath11k: fix -Wformat-truncation warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/17/2023 8:53 AM, Dmitry Antipov wrote:
Fix the following warning observed with GCC 13.2 and -Wformat-truncation:

drivers/net/wireless/ath/ath11k/debugfs.c: In function ‘ath11k_debugfs_register’:
drivers/net/wireless/ath/ath11k/debugfs.c:1597:51: warning: ‘%d’ directive output
may be truncated writing between 1 and 3 bytes into a region of size 2 [-Wformat-truncation=]
  1597 |         snprintf(pdev_name, sizeof(pdev_name), "%s%d", "mac", ar->pdev_idx);
       |                                                   ^~
drivers/net/wireless/ath/ath11k/debugfs.c:1597:48: note: directive argument in the range [0, 255]
  1597 |         snprintf(pdev_name, sizeof(pdev_name), "%s%d", "mac", ar->pdev_idx);
       |                                                ^~~~~~
drivers/net/wireless/ath/ath11k/debugfs.c:1597:9: note: ‘snprintf’ output between
5 and 7 bytes into a destination of size 5
  1597 |         snprintf(pdev_name, sizeof(pdev_name), "%s%d", "mac", ar->pdev_idx);
       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Simplify the 'snprintf()' statement as well.

Suggested-by: Kalle Valo <kvalo@xxxxxxxxxx>
Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
Acked-by: Jeff Johnson <quic_jjohnson@xxxxxxxxxxx>




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux