2023-10-09 07:10:15

by Kalle Valo

[permalink] [raw]
Subject: [RFH] wireless-next: fix new W=1 warnings

Hi,

During the weekend we updated wireless-next tree from v6.5 to v6.6-rc4+.
It looks like a new warning was enabled for v6.6 as I see with GCC 13.2
and W=1 several warnings (list below). In v6.5 wireless code was still
W=1 warning free with GCC.

For wireless we get lots of questionable cleanup patches. But actually
these kind of warnings are what we would prefer to be fixed instead of
the random churn we always see. Hence I'm sending this Request For Help
(RFH) in case the cleanup people would fix these. Is there a mailing
list I should send this to?

The sooner these are fixed the better, it makes it difficult for us to
see any new warnings from this noise.

Kalle

drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:63: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:9: note: 'snprintf' output between 4 and 140 bytes into a destination of size 32
drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:63: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:9: note: 'snprintf' output between 4 and 98 bytes into a destination of size 32
drivers/net/wireless/intel/iwlwifi/dvm/main.c:1467:19: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
drivers/net/wireless/intel/iwlwifi/dvm/main.c:1465:9: note: 'snprintf' output between 1 and 64 bytes into a destination of size 32
drivers/net/wireless/intel/iwlwifi/mvm/ops.c:1307:19: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
drivers/net/wireless/intel/iwlwifi/mvm/ops.c:1305:9: note: 'snprintf' output between 1 and 64 bytes into a destination of size 32
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:52: warning: '%d' directive output may be truncated writing between 1 and 5 bytes into a region of size 4 [-Wformat-truncation=]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:46: note: directive argument in the range [0, 65535]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:46: note: directive argument in the range [0, 65535]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:9: note: 'snprintf' output between 9 and 17 bytes into a destination of size 9
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:55: warning: '%d' directive output may be truncated writing between 1 and 5 bytes into a region of size 4 [-Wformat-truncation=]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:48: note: directive argument in the range [0, 65535]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:48: note: directive argument in the range [0, 65535]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:9: note: 'snprintf' output between 10 and 18 bytes into a destination of size 10
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:342:50: warning: '/' directive output may be truncated writing 1 byte into a region of size between 0 and 4 [-Wformat-truncation=]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:342:42: note: directive argument in the range [0, 65535]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:342:9: note: 'snprintf' output between 10 and 18 bytes into a destination of size 10
drivers/net/wireless/intel/iwlwifi/iwl-drv.c:549:33: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size between 48 and 56 [-Wformat-truncation=]
drivers/net/wireless/intel/iwlwifi/iwl-drv.c:547:9: note: 'snprintf' output 9 or more bytes (assuming 80) into a destination of size 64
drivers/net/wireless/intel/iwlwifi/iwl-drv.c:729:33: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size between 48 and 56 [-Wformat-truncation=]
drivers/net/wireless/intel/iwlwifi/iwl-drv.c:727:9: note: 'snprintf' output 9 or more bytes (assuming 80) into a destination of size 64
drivers/net/wireless/intel/iwlwifi/iwl-drv.c:989:51: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size between 46 and 58 [-Wformat-truncation=]
drivers/net/wireless/intel/iwlwifi/iwl-drv.c:987:33: note: 'snprintf' output between 7 and 82 bytes into a destination of size 64
drivers/net/wireless/intel/iwlwifi/iwl-drv.c:984:53: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size between 40 and 50 [-Wformat-truncation=]
drivers/net/wireless/intel/iwlwifi/iwl-drv.c:982:33: note: 'snprintf' output between 15 and 88 bytes into a destination of size 64
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=]
drivers/net/wireless/ath/ath11k/debugfs.c:1597:48: note: directive argument in the range [0, 255]
drivers/net/wireless/ath/ath11k/debugfs.c:1597:9: note: 'snprintf' output between 5 and 7 bytes into a destination of size 5
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=]
drivers/net/wireless/ath/ath9k/hif_usb.c:1222:17: note: 'snprintf' output between 27 and 34 bytes into a destination of size 32


2023-10-09 09:07:31

by Bagas Sanjaya

[permalink] [raw]
Subject: Re: [RFH] wireless-next: fix new W=1 warnings

On Mon, Oct 09, 2023 at 10:09:53AM +0300, Kalle Valo wrote:
> Hi,
>
> During the weekend we updated wireless-next tree from v6.5 to v6.6-rc4+.
> It looks like a new warning was enabled for v6.6 as I see with GCC 13.2
> and W=1 several warnings (list below). In v6.5 wireless code was still
> W=1 warning free with GCC.

Can you pin-point the exact commit that introduces the warnings?

>
> For wireless we get lots of questionable cleanup patches. But actually
> these kind of warnings are what we would prefer to be fixed instead of
> the random churn we always see. Hence I'm sending this Request For Help
> (RFH) in case the cleanup people would fix these. Is there a mailing
> list I should send this to?

[also Cc: maintainers and lists for files below]

>
> The sooner these are fixed the better, it makes it difficult for us to
> see any new warnings from this noise.
>
> Kalle
>
> drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:63: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
> drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:9: note: 'snprintf' output between 4 and 140 bytes into a destination of size 32
> drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:63: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
> drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:9: note: 'snprintf' output between 4 and 98 bytes into a destination of size 32
> drivers/net/wireless/intel/iwlwifi/dvm/main.c:1467:19: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/dvm/main.c:1465:9: note: 'snprintf' output between 1 and 64 bytes into a destination of size 32
> drivers/net/wireless/intel/iwlwifi/mvm/ops.c:1307:19: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/mvm/ops.c:1305:9: note: 'snprintf' output between 1 and 64 bytes into a destination of size 32
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:52: warning: '%d' directive output may be truncated writing between 1 and 5 bytes into a region of size 4 [-Wformat-truncation=]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:46: note: directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:46: note: directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:9: note: 'snprintf' output between 9 and 17 bytes into a destination of size 9
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:55: warning: '%d' directive output may be truncated writing between 1 and 5 bytes into a region of size 4 [-Wformat-truncation=]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:48: note: directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:48: note: directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:9: note: 'snprintf' output between 10 and 18 bytes into a destination of size 10
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:342:50: warning: '/' directive output may be truncated writing 1 byte into a region of size between 0 and 4 [-Wformat-truncation=]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:342:42: note: directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:342:9: note: 'snprintf' output between 10 and 18 bytes into a destination of size 10
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:549:33: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size between 48 and 56 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:547:9: note: 'snprintf' output 9 or more bytes (assuming 80) into a destination of size 64
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:729:33: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size between 48 and 56 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:727:9: note: 'snprintf' output 9 or more bytes (assuming 80) into a destination of size 64
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:989:51: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size between 46 and 58 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:987:33: note: 'snprintf' output between 7 and 82 bytes into a destination of size 64
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:984:53: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size between 40 and 50 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:982:33: note: 'snprintf' output between 15 and 88 bytes into a destination of size 64
> 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=]
> drivers/net/wireless/ath/ath11k/debugfs.c:1597:48: note: directive argument in the range [0, 255]
> drivers/net/wireless/ath/ath11k/debugfs.c:1597:9: note: 'snprintf' output between 5 and 7 bytes into a destination of size 5
> 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=]
> drivers/net/wireless/ath/ath9k/hif_usb.c:1222:17: note: 'snprintf' output between 27 and 34 bytes into a destination of size 32

There is only one commit touching above files in current cycle, that is b2fd72aafb1311 ("wifi: ath9k: Remove unnecessary ternary operators").

That's what I know.

--
An old man doll... just what I always wanted! - Clara


Attachments:
(No filename) (5.90 kB)
signature.asc (235.00 B)
Download all attachments

2023-10-17 15:01:44

by Arend Van Spriel

[permalink] [raw]
Subject: Re: [RFH] wireless-next: fix new W=1 warnings

On October 9, 2023 9:10:11 AM Kalle Valo <[email protected]> wrote:

> Hi,
>
> During the weekend we updated wireless-next tree from v6.5 to v6.6-rc4+.
> It looks like a new warning was enabled for v6.6 as I see with GCC 13.2
> and W=1 several warnings (list below). In v6.5 wireless code was still
> W=1 warning free with GCC.

Can't say I am a big fan of this new warning, but I will look at the
brcmfmac related warnings.

Btw. is it possible to opt out per driver.

Regards,
Arend

>
> For wireless we get lots of questionable cleanup patches. But actually
> these kind of warnings are what we would prefer to be fixed instead of
> the random churn we always see. Hence I'm sending this Request For Help
> (RFH) in case the cleanup people would fix these. Is there a mailing
> list I should send this to?
>
> The sooner these are fixed the better, it makes it difficult for us to
> see any new warnings from this noise.
>
> Kalle
>
> drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:63: warning: '%s'
> directive output may be truncated writing up to 63 bytes into a region of
> size 32 [-Wformat-truncation=]
> drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:9: note: 'snprintf'
> output between 4 and 140 bytes into a destination of size 32
> drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:63: warning: '%s'
> directive output may be truncated writing up to 63 bytes into a region of
> size 32 [-Wformat-truncation=]
> drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:9: note: 'snprintf'
> output between 4 and 98 bytes into a destination of size 32
> drivers/net/wireless/intel/iwlwifi/dvm/main.c:1467:19: warning: '%s'
> directive output may be truncated writing up to 63 bytes into a region of
> size 32 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/dvm/main.c:1465:9: note: 'snprintf'
> output between 1 and 64 bytes into a destination of size 32
> drivers/net/wireless/intel/iwlwifi/mvm/ops.c:1307:19: warning: '%s'
> directive output may be truncated writing up to 63 bytes into a region of
> size 32 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/mvm/ops.c:1305:9: note: 'snprintf'
> output between 1 and 64 bytes into a destination of size 32
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:52:
> warning: '%d' directive output may be truncated writing between 1 and 5
> bytes into a region of size 4 [-Wformat-truncation=]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:46: note:
> directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:46: note:
> directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:262:9: note:
> 'snprintf' output between 9 and 17 bytes into a destination of size 9
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:55:
> warning: '%d' directive output may be truncated writing between 1 and 5
> bytes into a region of size 4 [-Wformat-truncation=]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:48: note:
> directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:48: note:
> directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:265:9: note:
> 'snprintf' output between 10 and 18 bytes into a destination of size 10
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:342:50:
> warning: '/' directive output may be truncated writing 1 byte into a region
> of size between 0 and 4 [-Wformat-truncation=]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:342:42: note:
> directive argument in the range [0, 65535]
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:342:9: note:
> 'snprintf' output between 10 and 18 bytes into a destination of size 10
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:549:33: warning: '%s'
> directive output may be truncated writing up to 63 bytes into a region of
> size between 48 and 56 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:547:9: note: 'snprintf' output
> 9 or more bytes (assuming 80) into a destination of size 64
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:729:33: warning: '%s'
> directive output may be truncated writing up to 63 bytes into a region of
> size between 48 and 56 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:727:9: note: 'snprintf' output
> 9 or more bytes (assuming 80) into a destination of size 64
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:989:51: warning: '%s'
> directive output may be truncated writing up to 63 bytes into a region of
> size between 46 and 58 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:987:33: note: 'snprintf'
> output between 7 and 82 bytes into a destination of size 64
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:984:53: warning: '%s'
> directive output may be truncated writing up to 63 bytes into a region of
> size between 40 and 50 [-Wformat-truncation=]
> drivers/net/wireless/intel/iwlwifi/iwl-drv.c:982:33: note: 'snprintf'
> output between 15 and 88 bytes into a destination of size 64
> 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=]
> drivers/net/wireless/ath/ath11k/debugfs.c:1597:48: note: directive argument
> in the range [0, 255]
> drivers/net/wireless/ath/ath11k/debugfs.c:1597:9: note: 'snprintf' output
> between 5 and 7 bytes into a destination of size 5
> 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=]
> drivers/net/wireless/ath/ath9k/hif_usb.c:1222:17: note: 'snprintf' output
> between 27 and 34 bytes into a destination of size 32



2023-10-17 15:32:03

by Kalle Valo

[permalink] [raw]
Subject: Re: [RFH] wireless-next: fix new W=1 warnings

Arend van Spriel <[email protected]> writes:

> On October 9, 2023 9:10:11 AM Kalle Valo <[email protected]> wrote:
>
>> Hi,
>>
>> During the weekend we updated wireless-next tree from v6.5 to v6.6-rc4+.
>> It looks like a new warning was enabled for v6.6 as I see with GCC 13.2
>> and W=1 several warnings (list below). In v6.5 wireless code was still
>> W=1 warning free with GCC.
>
> Can't say I am a big fan of this new warning, but I will look at the
> brcmfmac related warnings.

I already sent a patch, please take a look:

https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

> Btw. is it possible to opt out per driver.

Usually that's not preferred.

--
https://patchwork.kernel.org/project/linux-wireless/list/

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