All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
To: Dan Carpenter <error27@gmail.com>, guennadi.liakhovetski@linux.intel.com
Cc: alsa-devel@alsa-project.org
Subject: Re: [bug report] ASoC: SOF: avoid a NULL dereference with unsupported widgets
Date: Fri, 31 Mar 2023 10:14:11 +0300	[thread overview]
Message-ID: <80f2a9e2-a2fb-4543-b381-251bb07876ef@linux.intel.com> (raw)
In-Reply-To: <4826f662-42f0-4a82-ba32-8bf5f8a03256@kili.mountain>

Hi Dan,

On 31/03/2023 09:58, Dan Carpenter wrote:
> Hello Guennadi Liakhovetski,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch e3720f92e023: "ASoC: SOF: avoid a NULL dereference with 
> unsupported widgets" from Mar 29, 2023, leads to the following Smatch 
> complaint:
> 
> sound/soc/sof/ipc4-topology.c:2353 sof_ipc4_route_setup()
> error: we previously assumed 'sink_fw_module' could be null (see line 2351)
> 
> sound/soc/sof/ipc4-topology.c:2353 sof_ipc4_route_setup()
> error: we previously assumed 'src_fw_module' could be null (see line 2351)
> 
> sound/soc/sof/ipc4-topology.c
>   2350	
>   2351		if (!src_fw_module || !sink_fw_module) {
>                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> One of these is NULL.
> 
>   2352			/* The NULL module will print as "(efault)" */
>   2353			dev_err(sdev->dev, "source %s or sink %s widget weren't set up properly\n",
>   2354				src_fw_module->man4_module_entry.name,
>   2355				sink_fw_module->man4_module_entry.name);
>                                 ^^^^^^^^^^^^^^
> Both are dereferenced.  The comment is very puzzling.

if src_fw_module is NULL then the print will be:
source (efault) or sink sink.module.name widget weren't set up properly

Guennadi is relying on some black magic in the printk system to handle
the printing instead of open coding.

-- 
Péter

  reply	other threads:[~2023-03-31  7:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31  6:58 [bug report] ASoC: SOF: avoid a NULL dereference with unsupported widgets Dan Carpenter
2023-03-31  7:14 ` Péter Ujfalusi [this message]
2023-04-01  7:44   ` Dan Carpenter
2023-04-03  5:20     ` Péter Ujfalusi
2023-04-03  5:54       ` Dan Carpenter
2023-04-03  7:08         ` Péter Ujfalusi
2023-04-11 16:22           ` Guennadi Liakhovetski
2023-04-13  4:41             ` Dan Carpenter
2023-04-13  4:46               ` 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=80f2a9e2-a2fb-4543-b381-251bb07876ef@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=error27@gmail.com \
    --cc=guennadi.liakhovetski@linux.intel.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.