lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOh2x=k=ok6eXPbuhJbJRu8LBoRzT4hrEz2dWrho0j+z=SJB5w@mail.gmail.com>
Date:   Tue, 27 Sep 2016 15:02:47 +0530
From:   Viresh Kumar <viresh.kumar@...aro.org>
To:     Vaibhav Agarwal <vaibhav.sr@...il.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Alex Elder <elder@...aro.org>, Johan Hovold <johan@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Colin King <colin.king@...onical.com>,
        devel@...verdev.osuosl.org
Subject: Re: [PATCH] greybus: audio: fix uninitialized variable errors found
 by cppcheck

On Sat, Sep 24, 2016 at 11:06 PM, Vaibhav Agarwal <vaibhav.sr@...il.com> wrote:
> Currently, if info is null, the dev_err message is dereferencing an
> uninitialized module pointer.  Instead, it should use codec->dev pointer
> in dev_err call and better align with other err msg in this function.
>
> Also, ret variable might be used uninitialized in a specific case.
> Avoid using it this way.
>
> Found using static analysis with cppcheck:
> Checking drivers/staging/greybus/audio_topology.c...
> [drivers/staging/greybus/audio_topology.c:175]: (error) Uninitialized
> variable: module
> [drivers/staging/greybus/audio_topology.c:495]: (error) Uninitialized
> variable: ret
>
> Reported-by: Colin Ian King <colin.king@...onical.com>
> Signed-off-by: Vaibhav Agarwal <vaibhav.sr@...il.com>
> ---
>  drivers/staging/greybus/audio_topology.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c
> index f9f33817a092..b6251691a33d 100644
> --- a/drivers/staging/greybus/audio_topology.c
> +++ b/drivers/staging/greybus/audio_topology.c
> @@ -172,7 +172,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol,
>         info = (struct gb_audio_ctl_elem_info *)data->info;
>
>         if (!info) {
> -               dev_err(module->dev, "NULL info for %s\n", uinfo->id.name);
> +               dev_err(codec->dev, "NULL info for %s\n", uinfo->id.name);
>                 return -EINVAL;
>         }
>
> @@ -489,10 +489,11 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
>                         dev_err_ratelimited(codec->dev,
>                                             "%d:Error in %s for %s\n", ret,
>                                             __func__, kcontrol->id.name);
> +                       return ret;
>                 }
>         }
>
> -       return ret;
> +       return 0;
>  }
>
>  #define SOC_DAPM_MIXER_GB(xname, kcount, data) \

Acked-by: Viresh Kumar <viresh.kumar@...aro.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ