lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Sep 2023 12:18:04 +0200
From:   "Arnd Bergmann" <arnd@...db.de>
To:     "Peter Ujfalusi" <peter.ujfalusi@...ux.intel.com>, tiwai@...e.com,
        "Jaroslav Kysela" <perex@...ex.cz>
Cc:     "Masahiro Yamada" <masahiroy@...nel.org>,
        linux-kernel@...r.kernel.org, alsa-devel@...a-project.org
Subject: Re: [PATCH] ALSA: core: Increase the name array size for debugfs directory
 name

On Tue, Sep 12, 2023, at 10:39, Peter Ujfalusi wrote:

> While the code is correct, we need to silence the compiler somehow.
> It could be done by limiting the range in sprintf like
> sprintf(name, "card%d", idx % SNDRV_CARDS);
> sprintf(name, "card%hhd", idx);
> etc
>
> These are too workaroundish. Increase the name array to 15 instead which
> looks better and only adds 7 bytes on stack.

It looks like we use the same string for kobject_set_name(), so
maybe this would work as well:

--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -278,9 +278,6 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
                         size_t extra_size)
 {
        int err;
-#ifdef CONFIG_SND_DEBUG
-       char name[8];
-#endif
 
        if (extra_size > 0)
                card->private_data = (char *)card + sizeof(struct snd_card);
@@ -364,8 +361,8 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
        }
 
 #ifdef CONFIG_SND_DEBUG
-       sprintf(name, "card%d", idx);
-       card->debugfs_root = debugfs_create_dir(name, sound_debugfs_root);
+       card->debugfs_root = debugfs_create_dir(kobject_name(&card->card_dev.kobj),
+                                               sound_debugfs_root);
 #endif
        return 0;
 

   Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ