* [PATCH] ASoC: cs35l56-shared-test: Fix possible null pointer dereference
@ 2026-05-23 21:15 Ethan Tidmore
2026-05-25 9:49 ` Richard Fitzgerald
2026-05-26 15:38 ` Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Ethan Tidmore @ 2026-05-23 21:15 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: David Rhodes, Richard Fitzgerald, Jaroslav Kysela, Takashi Iwai,
patches, linux-sound, linux-kernel, Ethan Tidmore
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")
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);
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: cs35l56-shared-test: Fix possible null pointer dereference
2026-05-23 21:15 [PATCH] ASoC: cs35l56-shared-test: Fix possible null pointer dereference Ethan Tidmore
@ 2026-05-25 9:49 ` Richard Fitzgerald
2026-05-25 10:45 ` Mark Brown
2026-05-26 15:38 ` Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: Richard Fitzgerald @ 2026-05-25 9:49 UTC (permalink / raw)
To: Ethan Tidmore, Mark Brown, Liam Girdwood
Cc: David Rhodes, Jaroslav Kysela, Takashi Iwai, patches,
linux-sound, linux-kernel
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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: cs35l56-shared-test: Fix possible null pointer dereference
2026-05-25 9:49 ` Richard Fitzgerald
@ 2026-05-25 10:45 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-05-25 10:45 UTC (permalink / raw)
To: Richard Fitzgerald
Cc: Ethan Tidmore, Liam Girdwood, David Rhodes, Jaroslav Kysela,
Takashi Iwai, patches, linux-sound, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 581 bytes --]
On Mon, May 25, 2026 at 10:49:03AM +0100, Richard Fitzgerald wrote:
> 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.
You'll only get a notification for the most current version with my
current tooling (people complained about getting notifications on old
versions...) and if you resend quickly things might already be in my CI.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: cs35l56-shared-test: Fix possible null pointer dereference
2026-05-23 21:15 [PATCH] ASoC: cs35l56-shared-test: Fix possible null pointer dereference Ethan Tidmore
2026-05-25 9:49 ` Richard Fitzgerald
@ 2026-05-26 15:38 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-05-26 15:38 UTC (permalink / raw)
To: Liam Girdwood, Ethan Tidmore
Cc: David Rhodes, Richard Fitzgerald, Jaroslav Kysela, Takashi Iwai,
patches, linux-sound, linux-kernel
On Sat, 23 May 2026 16:15:22 -0500, Ethan Tidmore wrote:
> ASoC: cs35l56-shared-test: Fix possible null pointer dereference
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2
Thanks!
[1/1] ASoC: cs35l56-shared-test: Fix possible null pointer dereference
https://git.kernel.org/broonie/sound/c/4fa26292e8dc
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-26 18:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-23 21:15 [PATCH] ASoC: cs35l56-shared-test: Fix possible null pointer dereference Ethan Tidmore
2026-05-25 9:49 ` Richard Fitzgerald
2026-05-25 10:45 ` Mark Brown
2026-05-26 15:38 ` Mark Brown
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®