ATH11K Archive mirror
 help / color / mirror / Atom feed
From: Jeff Johnson <quic_jjohnson@quicinc.com>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Kalle Valo <kvalo@kernel.org>, <ath11k@lists.infradead.org>,
	<linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] wifi: ath11k: fix -Wformat-truncation warning
Date: Tue, 17 Oct 2023 12:38:31 -0700	[thread overview]
Message-ID: <8a825923-c34d-40b5-812e-e28a25c83eb5@quicinc.com> (raw)
In-Reply-To: <20231017155342.112032-1-dmantipov@yandex.ru>

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@kernel.org>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>


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

      reply	other threads:[~2023-10-17 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87fs2k5l1a.fsf@kernel.org>
2023-10-09  9:07 ` [RFH] wireless-next: fix new W=1 warnings Bagas Sanjaya
2023-10-17 15:53 ` [PATCH] wifi: ath11k: fix -Wformat-truncation warning Dmitry Antipov
2023-10-17 19:38   ` Jeff Johnson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a825923-c34d-40b5-812e-e28a25c83eb5@quicinc.com \
    --to=quic_jjohnson@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --cc=dmantipov@yandex.ru \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).