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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871pjgfrto.wl-tiwai@suse.de>
Date: Fri, 23 Jan 2026 13:15:31 +0100
From: Takashi Iwai <tiwai@...e.de>
To: Jaroslav Kysela <perex@...ex.cz>
Cc: Maciej Strozek <mstrozek@...nsource.cirrus.com>,
	Takashi Iwai <tiwai@...e.com>,
	linux-kernel@...r.kernel.org,
	linux-sound@...r.kernel.org,
	patches@...nsource.cirrus.com,
	alsa-devel@...a-project.org
Subject: Re: [PATCH v2] ALSA: control: add ioctl to retrieve full card components

On Thu, 22 Jan 2026 14:30:04 +0100,
Jaroslav Kysela wrote:
> 
> On 1/22/26 12:12, Maciej Strozek wrote:
> > The fixed-size components field in SNDRV_CTL_IOCTL_CARD_INFO can be too
> > small on systems with many audio devices.
> > 
> > Keep the existing struct snd_ctl_card_info ABI intact and add a new ioctl
> > to retrieve the full components string.
> > 
> > When the legacy components field is truncated, append '>' to indicate
> > that the full string is available via the new ioctl.
> 
> Thanks for the patch. Comments bellow.
> 
> > @@ -88,7 +89,8 @@ struct snd_card {
> >   	char irq_descr[32];		/* Interrupt description */
> >   	char mixername[80];		/* mixer name */
> >   	char components[128];		/* card components delimited with
> > -								space */
> > +								space, truncated to 127 chars */
> > +	char components_extended[SNDRV_CTL_COMPONENTS_LEN];	/* full card components string */
> 
> I would remove the original components[128] string and replace it
> with dynamically allocated 'char *components_ptr' with 'unsigned int
> components_ptr_alloc' to store allocated size. Then the
> snd_component_add() function may allocate (and resize) dynamically the
> components_ptr on demand (using e.g. 32 byte step). This will also
> catch all drivers using the original struct member when compiled and
> make the memory usage a little bit happier.

Agreed that it'd be better to point to the dynamic allocated array.

And, we can basically drop the limit, too.
For example, the ioctl can store the size of the string in return
while filling up to the given length.  So, when user-space gives
snd_ctl_card_components.length = 0, it just stores the actual string
size to this length field.  Then user-space can allocate the needed
buffer and get the actual string.

Or, user-space allocates a large-enough size buffer, set to length,
and check the actually returned length, too.

Of course, we may (should) have some upper-limit internally for a
sanity check, but it doesn't have to be exposed as a part of ABI.


thanks,

Takashi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ