From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: Ethan Tidmore <ethantidmore06@gmail.com>,
Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>
Cc: David Rhodes <david.rhodes@cirrus.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
patches@opensource.cirrus.com, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: cs35l56-shared-test: Fix possible null pointer dereference
Date: Mon, 25 May 2026 10:49:03 +0100 [thread overview]
Message-ID: <c0252afa-ad78-4e36-9a7d-8a8afb04e1d8@opensource.cirrus.com> (raw)
In-Reply-To: <20260523211522.522616-1-ethantidmore06@gmail.com>
On 23/05/2026 10:15 pm, Ethan Tidmore wrote:
> The struct regmap_config is dereferenced before its check. Also, after
> it is checked priv->reg_offset is assigned to regmap_config->reg_base,
> making the removed line redundant.
>
> Detected by Smatch:
> sound/soc/codecs/cs35l56-shared-test.c:681 cs35l56_shared_test_case_base_init()
> warn: variable dereferenced before check 'regmap_config' (see line 665)
>
> Fixes: a6f7c21accb5f ("ASoC: cs35l56-shared-test: Subtract reg_base offset in dummy regmap")
If you apply this change on top of commit a6f7c21accb5f it would break
the test because it removes the line instead of moving it to a different
place.
Something weird has happened here. I already fixed this in V4 of the
patch series. It turns out that V3 was already merged, but I didn't
receive a merge notificiation. V4 has then been merged on top so Mark's
for-7.2 and for-next contain the combination of V3 and V4 but this
fix commit doesn't make sense for either version, only the final
composite result.
Mark:
There isn't actually a bug here. regmap_config is always a valid
pointer in the current code. The later NULL check is currently
redundant.
I suggest (to avoid the confusion of which Fixes: SHA it
should reference) this is just added to for-next as a cleanup (not a
Fixes), since there's no bug.
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
> ---
> sound/soc/codecs/cs35l56-shared-test.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/sound/soc/codecs/cs35l56-shared-test.c b/sound/soc/codecs/cs35l56-shared-test.c
> index 5b2b915559a9..4f52c8a192e5 100644
> --- a/sound/soc/codecs/cs35l56-shared-test.c
> +++ b/sound/soc/codecs/cs35l56-shared-test.c
> @@ -662,7 +662,6 @@ static int cs35l56_shared_test_case_base_init(struct kunit *test, u8 type, u8 re
>
> test->priv = priv;
> priv->test = test;
> - priv->reg_offset = regmap_config->reg_base;
>
> /* Create dummy amp driver dev */
> priv->amp_dev = faux_device_create("cs35l56_shared_test_drv", NULL, NULL);
next prev parent reply other threads:[~2026-05-25 9:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 21:15 Ethan Tidmore
2026-05-25 9:49 ` Richard Fitzgerald [this message]
2026-05-25 10:45 ` Mark Brown
2026-05-26 15:38 ` Mark Brown
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=c0252afa-ad78-4e36-9a7d-8a8afb04e1d8@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=david.rhodes@cirrus.com \
--cc=ethantidmore06@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--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®