mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: Maciej Strozek <mstrozek@opensource.cirrus.com>,
	Takashi Iwai <tiwai@suse.com>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	alsa-devel@alsa-project.org, patches@opensource.cirrus.com
Subject: Re: [PATCH RESEND v4 2/2] ALSA: control: add ioctl to retrieve full card components
Date: Thu, 25 Jun 2026 14:40:36 +0200	[thread overview]
Message-ID: <123fc447-bc60-48a3-a2a1-46ee9041e6ea@perex.cz> (raw)
In-Reply-To: <20260625120741.3404473-2-mstrozek@opensource.cirrus.com>

On 6/25/26 14:07, Maciej Strozek wrote:

...

> +struct snd_ctl_card_bytes {
> +	unsigned int type;		/* SND_CTL_CARD_BTYPE_* */
> +	unsigned int data_allocated;	/* size of @data buffer in bytes */
> +	unsigned int data_len;		/* in/out: actual data length in bytes */
> +	unsigned char *data;		/* user buffer */

I know that I suggested to add code to the compat layer. But it seems that new 
UAPIs are using just '__u64 data' here with padding to 8 bytes (I would add 
new reserved field and perhaps we may use force `__u32' type for all other 
fields). The code in kernel sound translate the u64 data to pointer using 
u64_to_user_ptr() function.

So like:

struct snd_ctl_card_bytes {
       __u32 type;
       __u32 data_allocated;
       __u32 data_len;
       __u32 reserved;   /* explicit pad */
       __u64 data;       /* pointer as __u64 */
};

> +static int snd_ctl_card_bytes(struct snd_card *card,
> +			      struct snd_ctl_card_bytes *info,
> +			      unsigned int __user *data_len_out)
> +{
> +	unsigned int data_len;
> +
> +	switch (info->type) {
> +	case SND_CTL_CARD_BTYPE_COMPONENTS:
> +		scoped_guard(rwsem_read, &snd_ioctl_rwsem) {
> +			data_len = strlen(card->components) + 1;

The field card->components may be NULL here, also fix other uses like in 
snd_ctl_card_info().

		Thank you,
			Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat

      reply	other threads:[~2026-06-25 12:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25 12:07 [PATCH RESEND v4 1/2] ALSA: control: tidy up whitespaces Maciej Strozek
2026-06-25 12:07 ` [PATCH RESEND v4 2/2] ALSA: control: add ioctl to retrieve full card components Maciej Strozek
2026-06-25 12:40   ` Jaroslav Kysela [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=123fc447-bc60-48a3-a2a1-46ee9041e6ea@perex.cz \
    --to=perex@perex.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=mstrozek@opensource.cirrus.com \
    --cc=patches@opensource.cirrus.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®