[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200814105616.GP1793@kadam>
Date: Fri, 14 Aug 2020 13:56:16 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Vaibhav Agarwal <vaibhav.sr@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alex Elder <elder@...nel.org>, Johan Hovold <johan@...nel.org>,
Mark Greer <mgreer@...malcreek.com>,
devel@...verdev.osuosl.org, greybus-dev@...ts.linaro.org,
Colin Ian King <colin.king@...onical.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] staging: greybus: audio: fix uninitialized value issue
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@...onical.com>
> Signed-off-by: Vaibhav Agarwal <vaibhav.sr@...il.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
Powered by blists - more mailing lists