ATH11K Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: ath11k: ath11k_debugfs_register(): fix format-truncation warning
@ 2023-10-10  6:22 Kalle Valo
  2023-10-10 15:23 ` Jeff Johnson
  2023-10-12 16:04 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Kalle Valo @ 2023-10-10  6:22 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless

From: Kalle Valo <quic_kvalo@quicinc.com>

In v6.6-rc4 with GCC 13.2 I see a new warning:

drivers/net/wireless/ath/ath11k/debugfs.c: In function 'ath11k_debugfs_register':
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=]
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

Increase the size of pdev_name to 10 bytes to make sure there's enough room for
the string. Also change the format to '%u' as ar->pdev_idx is u8.

Compile tested only.

Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c
index 5bb6fd17fdf6..6f89e24cb612 100644
--- a/drivers/net/wireless/ath/ath11k/debugfs.c
+++ b/drivers/net/wireless/ath/ath11k/debugfs.c
@@ -1591,10 +1591,10 @@ static const struct file_operations fops_ps_state_enable = {
 int ath11k_debugfs_register(struct ath11k *ar)
 {
 	struct ath11k_base *ab = ar->ab;
-	char pdev_name[5];
+	char pdev_name[10];
 	char buf[100] = {0};
 
-	snprintf(pdev_name, sizeof(pdev_name), "%s%d", "mac", ar->pdev_idx);
+	snprintf(pdev_name, sizeof(pdev_name), "%s%u", "mac", ar->pdev_idx);
 
 	ar->debug.debugfs_pdev = debugfs_create_dir(pdev_name, ab->debugfs_soc);
 	if (IS_ERR(ar->debug.debugfs_pdev))

base-commit: 54ca82af78699713bae8b086f46ae13179772085
-- 
2.39.2


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath11k: ath11k_debugfs_register(): fix format-truncation warning
  2023-10-10  6:22 [PATCH] wifi: ath11k: ath11k_debugfs_register(): fix format-truncation warning Kalle Valo
@ 2023-10-10 15:23 ` Jeff Johnson
  2023-10-12 16:04 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Johnson @ 2023-10-10 15:23 UTC (permalink / raw)
  To: Kalle Valo, ath11k; +Cc: linux-wireless

On 10/9/2023 11:22 PM, Kalle Valo wrote:
> From: Kalle Valo <quic_kvalo@quicinc.com>
> 
> In v6.6-rc4 with GCC 13.2 I see a new warning:
> 
> drivers/net/wireless/ath/ath11k/debugfs.c: In function 'ath11k_debugfs_register':
> 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=]
> 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
> 
> Increase the size of pdev_name to 10 bytes to make sure there's enough room for
> the string. Also change the format to '%u' as ar->pdev_idx is u8.
> 
> Compile tested only.
> 
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath11k: ath11k_debugfs_register(): fix format-truncation warning
  2023-10-10  6:22 [PATCH] wifi: ath11k: ath11k_debugfs_register(): fix format-truncation warning Kalle Valo
  2023-10-10 15:23 ` Jeff Johnson
@ 2023-10-12 16:04 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-10-12 16:04 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless

Kalle Valo <kvalo@kernel.org> wrote:

> In v6.6-rc4 with GCC 13.2 I see a new warning:
> 
> drivers/net/wireless/ath/ath11k/debugfs.c: In function 'ath11k_debugfs_register':
> 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=]
> 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
> 
> Increase the size of pdev_name to 10 bytes to make sure there's enough room for
> the string. Also change the format to '%u' as ar->pdev_idx is u8.
> 
> Compile tested only.
> 
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

a47111663491 wifi: ath11k: ath11k_debugfs_register(): fix format-truncation warning

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20231010062250.2580951-1-kvalo@kernel.org/

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


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-12 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10  6:22 [PATCH] wifi: ath11k: ath11k_debugfs_register(): fix format-truncation warning Kalle Valo
2023-10-10 15:23 ` Jeff Johnson
2023-10-12 16:04 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox