From: Dan Carpenter <dan.carpenter@oracle.com>
To: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alex Elder <elder@kernel.org>, Johan Hovold <johan@kernel.org>,
Mark Greer <mgreer@animalcreek.com>,
devel@driverdev.osuosl.org, greybus-dev@lists.linaro.org,
Colin Ian King <colin.king@canonical.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: greybus: audio: fix uninitialized value issue
Date: Fri, 14 Aug 2020 13:56:16 +0300 [thread overview]
Message-ID: <20200814105616.GP1793@kadam> (raw)
In-Reply-To: <b6a5c28b6812232c90426f77cbe60600f9a91019.1597389343.git.vaibhav.sr@gmail.com>
On Fri, Aug 14, 2020 at 01:07:20PM +0530, Vaibhav Agarwal wrote:
> The current implementation for gbcodec_mixer_dapm_ctl_put() uses
> uninitialized gbvalue for comparison with updated value. This was found
> using static analysis with coverity.
>
> Uninitialized scalar variable (UNINIT)
> 11. uninit_use: Using uninitialized value
> gbvalue.value.integer_value[0].
> 460 if (gbvalue.value.integer_value[0] != val) {
>
> This patch fixes the issue with fetching the gbvalue before using it for
> comparision.
>
> Fixes: 6339d2322c47 ("greybus: audio: Add topology parser for GB codec")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
> ---
> Changelog:
> v2: Fix the missing check for return value after get_control.
> ---
> drivers/staging/greybus/audio_topology.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c
> index 2f9fdbdcd547..9f98691b2f5f 100644
> --- a/drivers/staging/greybus/audio_topology.c
> +++ b/drivers/staging/greybus/audio_topology.c
> @@ -456,6 +456,18 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
> val = ucontrol->value.integer.value[0] & mask;
> connect = !!val;
>
> + ret = gb_pm_runtime_get_sync(bundle);
> + if (ret)
> + return ret;
> +
> + ret = gb_audio_gb_get_control(module->mgmt_connection, data->ctl_id,
> + GB_AUDIO_INVALID_INDEX, &gbvalue);
> + if (ret) {
> + dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret,
> + __func__, kcontrol->id.name);
gb_pm_runtime_put_autosuspend(bundle) on this error path?
> + return ret;
> + }
regards,
dan carpenter
prev parent reply other threads:[~2020-08-14 10:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-14 7:37 [PATCH v2] staging: greybus: audio: fix uninitialized value issue Vaibhav Agarwal
2020-08-14 10:56 ` Dan Carpenter [this message]
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=20200814105616.GP1793@kadam \
--to=dan.carpenter@oracle.com \
--cc=colin.king@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgreer@animalcreek.com \
--cc=vaibhav.sr@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox