Search Linux Wireless

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

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

 



Dmitry Antipov <dmantipov@xxxxxxxxx> wrote:

> 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>

As I didn't get any replies to my RFH I unfortunately already fixed this myself:

https://patchwork.kernel.org/project/linux-wireless/patch/20231012135854.3473332-3-kvalo@xxxxxxxxxx/

I just used a bigger buffer than you.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20231017155201.111950-1-dmantipov@xxxxxxxxx/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches




[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