mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Cc: tiwai@suse.com, perex@perex.cz, arnd@arndb.de,
	masahiroy@kernel.org, linux-kernel@vger.kernel.org,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: core: Use dev_name of card_dev as debugfs directory name
Date: Tue, 12 Sep 2023 15:31:26 +0200	[thread overview]
Message-ID: <87zg1r5xht.wl-tiwai@suse.de> (raw)
In-Reply-To: <20230912110113.3166-1-peter.ujfalusi@linux.intel.com>

On Tue, 12 Sep 2023 13:01:13 +0200,
Peter Ujfalusi wrote:
> 
> There is no need to use temporary string for the debugfs directory name as
> we can use the device name of the card.
> 
> This change will also fixes the following compiler warning/error (W=1):
> 
> sound/core/init.c: In function ‘snd_card_init’:
> sound/core/init.c:367:28: error: ‘%d’ directive writing between 1 and 10 bytes into a region of size 4 [-Werror=format-overflow=]
>   367 |         sprintf(name, "card%d", idx);
>       |                            ^~
> sound/core/init.c:367:23: note: directive argument in the range [0, 2147483646]
>   367 |         sprintf(name, "card%d", idx);
>       |                       ^~~~~~~~
> sound/core/init.c:367:9: note: ‘sprintf’ output between 6 and 15 bytes into a destination of size 8
>   367 |         sprintf(name, "card%d", idx);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> The idx is guarantied to be less than SNDRV_CARDS (max 256 or 8) by the
> code in snd_card_init(), however the compiler does not see that.
> 
> The warnings got brought to light by a recent patch upstream:
> commit 6d4ab2e97dcf ("extrawarn: enable format and stringop overflow warnings in W=1")
> 
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Suggested-by: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

Thanks, applied now.


Takashi

      reply	other threads:[~2023-09-12 13:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 11:01 Peter Ujfalusi
2023-09-12 13:31 ` Takashi Iwai [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=87zg1r5xht.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=tiwai@suse.com \
    /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

all inboxes | Powered by JetHome®