From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: Takashi Iwai <tiwai@suse.de>, <tiwai@suse.com>, <perex@perex.cz>,
<amade@asmblr.net>, <kuninori.morimoto.gx@renesas.com>,
<linux-sound@vger.kernel.org>
Subject: Re: [PATCH] ALSA: control: Verify put() result when in debug mode
Date: Wed, 4 Feb 2026 12:37:35 +0100 [thread overview]
Message-ID: <a215b553-d56a-4965-b6e7-0bab69e7473b@intel.com> (raw)
In-Reply-To: <245c0bad-9040-43c7-9c12-08919eb3640f@sirena.org.uk>
On 2026-01-30 4:13 PM, Mark Brown wrote:
> On Fri, Jan 30, 2026 at 04:00:10PM +0100, Cezary Rojewski wrote:
>> Wouldn't memset(0) as a preparation-step solve the issue? That is, each
>> element - instance of struct snd_ctl_elem_value - has up to 512 bytes of
>> data, regardless of type. Not seeing usefulness of ->info() here. Perhaps
>> I'm missing something.
>
> A memset() on the original value before reading would get it into a
> known state but wouldn't solve the problem that userpace can pass any
> old junk in the unused parts of the new value it passes into put().
Thank you for pointing this out. Indeed, "proper userspace" is not
always the case, which my v1 clearly forgot about.
I did few tests with ->info, namely info->type and info->count. Reused
the existing fill_remaining_elem_value() to be exact, with '0' as a
'pattern'. Hopefully that method is enough to deem whatever is provided
to ->put() worthy for the verification.
Kind regards,
Czarek
next prev parent reply other threads:[~2026-02-04 11:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 13:55 [PATCH] ALSA: control: Verify put() result when in debug mode Cezary Rojewski
2026-01-30 14:12 ` Mark Brown
2026-01-30 14:29 ` Takashi Iwai
2026-01-30 15:00 ` Cezary Rojewski
2026-01-30 15:13 ` Mark Brown
2026-02-04 11:37 ` Cezary Rojewski [this message]
2026-01-30 15:14 ` Takashi Iwai
2026-02-04 11:33 ` Cezary Rojewski
2026-01-30 14:49 ` Cezary Rojewski
2026-02-02 0:20 ` Kuninori Morimoto
2026-02-04 11:30 ` Cezary Rojewski
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=a215b553-d56a-4965-b6e7-0bab69e7473b@intel.com \
--to=cezary.rojewski@intel.com \
--cc=amade@asmblr.net \
--cc=broonie@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
/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