All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sreeraj S Kurup" <sreekuttan2156239@gmail.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v4] ALSA: control: Fix parsing of numeric fields
Date: Mon, 09 Nov 2026 16:07:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-205209@kernel.org> (raw)
In-Reply-To: <20261109155941.5850-1-sreekuttan2156239@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ALSA: control_led: unconsumed closing quote in parse_string()
  stops parsing
--

commit ca72582941d6fb9701c15b50af83f1b948e9bd29
Author: Sreeraj S Kurup <sreekuttan2156239@gmail.com>

ALSA: control: Fix parsing of numeric fields

This commit updates find_eos(), parse_uint(), and parse_string() so they
return the end of the current substring rather than advancing past the
delimiter, and NUL-terminates the numeric substring before calling
kstrtouint().

> diff --git a/sound/core/control_led.c b/sound/core/control_led.c
> index 3d55da3af2a05..8cfd305fc1d2a 100644
> --- a/sound/core/control_led.c
> +++ b/sound/core/control_led.c
[ ... ]
> @@ -491,8 +492,6 @@ static char *parse_string(char *s, char *val, size_t val_size)
>  		}
>  	}
>  	*val = '\0';
> -	if (*s)
> -		s++;
>  	return s;
>  }

[Severity: Medium]
Does removing "if (*s) s++;" at the end of parse_string() leave s pointing
at the closing quote when parsing a quoted string?

In the quoted-string branch, the loop stops when *s matches the opening
quote character:

sound/core/control_led.c:parse_string() {
	if (*s == '"' || *s == '\'') {
		char c = *s;
		s++;
		while (*s && *s != c) {
			...
			s++;
		}
	} else {
...

Previously, the trailing "if (*s) s++;" stepped past the closing quote so
that s pointed at the following comma (or NUL), and set_led_id() then
stepped past that comma.  With it removed, a quoted name followed by
another field (such as "name='Master Playback Switch',index=1") returns a
pointer to the closing quote, causing set_led_id() to miss the comma and
break out of its loop without parsing any remaining fields.  Advancing
past the closing quote inside the quoted-string branch would preserve the
expected return position.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109155941.5850-1-sreekuttan2156239@gmail.com?part=1

  reply	other threads:[~2026-11-09 16:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 15:45 [PATCH] ALSA: control: Fix parsing of numeric fields Sreeraj S Kurup
2026-11-06 15:54 ` sashiko-bot
2026-11-06 16:23 ` [PATCH v2] " Sreeraj S Kurup
2026-11-08  9:54   ` Sreeraj S Kurup
2026-11-08 10:44     ` Takashi Iwai
2026-11-08 11:18       ` Sreeraj S Kurup
2026-11-08 12:06         ` Takashi Iwai
2026-11-08 12:47           ` Sreeraj S Kurup
2026-11-08 12:48           ` [PATCH v3] " Sreeraj S Kurup
2026-11-08 16:48             ` Manuel Ebner
2026-11-09 14:33             ` Takashi Iwai
2026-11-09 15:58               ` Sreeraj S Kurup
2026-11-09 15:59             ` [PATCH v4] " Sreeraj S Kurup
2026-11-09 16:07               ` sashiko-bot [this message]
2026-11-09 16:35             ` [PATCH v5] " Sreeraj S Kurup
2026-11-10 10:27               ` Takashi Iwai
2026-11-11 10:56                 ` Sreeraj S Kurup

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=sashiko-outbox-205209@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sreekuttan2156239@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.