Search Linux Wireless

[PATCH] wifi: ath9k: fix -Wformat-truncation warning

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

 



Fix the following warning observed with GCC 13.2 and -Wformat-truncation:

drivers/net/wireless/ath/ath9k/hif_usb.c: In function ‘ath9k_hif_request_firmware’:
drivers/net/wireless/ath/ath9k/hif_usb.c:1223:42: warning: ‘.0.fw’ directive output
may be truncated writing 5 bytes into a region of size between 4 and 11 [-Wformat-truncation=]
 1223 |                          "%s/htc_%s-%d.%s.0.fw", HTC_FW_PATH,
      |                                          ^~~~~
drivers/net/wireless/ath/ath9k/hif_usb.c:1222:17: note: ‘snprintf’ output between
27 and 34 bytes into a destination of size 32
 1222 |                 snprintf(hif_dev->fw_name, sizeof(hif_dev->fw_name),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1223 |                          "%s/htc_%s-%d.%s.0.fw", HTC_FW_PATH,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1224 |                          chip, MAJOR_VERSION_REQ, index);

According to the comment in 'ath9k_hif_request_firmware()', 36 bytes should be enough.

Suggested-by: Kalle Valo <kvalo@xxxxxxxxxx>
Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
---
 drivers/net/wireless/ath/ath9k/hif_usb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h
index 5985aa15ca93..752ae288de1d 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.h
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.h
@@ -126,7 +126,7 @@ struct hif_device_usb {
 	struct usb_anchor reg_in_submitted;
 	struct usb_anchor mgmt_submitted;
 	struct sk_buff *remain_skb;
-	char fw_name[32];
+	char fw_name[36];
 	int fw_minor_index;
 	int rx_remain_len;
 	int rx_pkt_len;
-- 
2.41.0




[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