From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
Hans de Goede <hdegoede@redhat.com>
Cc: alsa-devel@alsa-project.org,
"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>,
Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>
Subject: Re: [bug report] ASoC: Intel: cht_bsw_rt5645: Set card.components string
Date: Mon, 22 Jul 2024 16:06:58 +0200 [thread overview]
Message-ID: <c7572302-7d78-4e72-a470-57f2aa0c8537@linux.intel.com> (raw)
In-Reply-To: <918944d2-3d00-465e-a9d1-5d57fc966113@stanley.mountain>
Thanks Dan for the report.
> Commit f87b4402163b ("ASoC: Intel: cht_bsw_rt5645: Set
> card.components string") from Nov 26, 2023 (linux-next), leads to the
> following Smatch static checker warning:
>
> sound/soc/intel/boards/cht_bsw_rt5645.c:587 snd_cht_mc_probe()
> error: we previously assumed 'adev' could be null (see line 581)
>
> sound/soc/intel/boards/cht_bsw_rt5645.c
> 570 /* set correct codec name */
> 571 for (i = 0; i < ARRAY_SIZE(cht_dailink); i++)
> 572 if (cht_dailink[i].codecs->name &&
> 573 !strcmp(cht_dailink[i].codecs->name,
> 574 "i2c-10EC5645:00")) {
> 575 dai_index = i;
> 576 break;
> 577 }
> 578
> 579 /* fixup codec name based on HID */
> 580 adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
> 581 if (adev) {
> ^^^^
> The old code assumes adev can be NULL
>
> 582 snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name),
> 583 "i2c-%s", acpi_dev_name(adev));
> 584 cht_dailink[dai_index].codecs->name = cht_rt5645_codec_name;
> 585 }
> 586 /* acpi_get_first_physical_node() returns a borrowed ref, no need to deref */
> --> 587 codec_dev = acpi_get_first_physical_node(adev);
> ^^^^
> Unchecked dereference
This looks like a problem in multiple machine drivers sharing similar
code, if we want to consistently check the output we probably need
something like https://github.com/thesofproject/linux/pull/5117 ?
next prev parent reply other threads:[~2024-07-22 14:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 23:53 [bug report] ASoC: Intel: cht_bsw_rt5645: Set card.components string Dan Carpenter
2024-07-22 14:06 ` Pierre-Louis Bossart [this message]
2024-07-23 15:38 ` Dan Carpenter
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=c7572302-7d78-4e72-a470-57f2aa0c8537@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=hdegoede@redhat.com \
--cc=linux-sound@vger.kernel.org \
--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