[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAs364-MaXu5JevibWzV1GD1VN+XQPGT1uBUke3-9MfUq7iWQQ@mail.gmail.com>
Date: Mon, 28 Mar 2022 13:44:09 +0530
From: Vaibhav Agarwal <vaibhav.sr@...il.com>
To: Xiaomeng Tong <xiam0nd.tong@...il.com>
Cc: Mark Greer <mgreer@...malcreek.com>,
Johan Hovold <johan@...nel.org>, Alex Elder <elder@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"moderated list:GREYBUS SUBSYSTEM" <greybus-dev@...ts.linaro.org>,
linux-staging@...ts.linux.dev,
open list <linux-kernel@...r.kernel.org>,
stable@...r.kernel.org
Subject: Re: [PATCH] greybus: audio_codec: fix three missing initializers for data
On Sun, Mar 27, 2022 at 11:31 AM Xiaomeng Tong <xiam0nd.tong@...il.com> wrote:
>
> These three bugs are here:
> struct gbaudio_data_connection *data;
>
> If the list '&codec->module_list' is empty then the 'data' will
> keep unchanged. However, the 'data' is not initialized and filled
> with trash value. As a result, if the value is not NULL, the check
> 'if (!data) {' will always be false and never exit expectly.
>
> To fix these bug, just initialize 'data' with NULL.
>
> Cc: stable@...r.kernel.org
> Fixes: 6dd67645f22cf ("greybus: audio: Use single codec driver registration")
> Signed-off-by: Xiaomeng Tong <xiam0nd.tong@...il.com>
> ---
> drivers/staging/greybus/audio_codec.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
> index b589cf6b1d03..939e05af4dcf 100644
> --- a/drivers/staging/greybus/audio_codec.c
> +++ b/drivers/staging/greybus/audio_codec.c
> @@ -397,7 +397,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream,
> u8 sig_bits, channels;
> u32 format, rate;
> struct gbaudio_module_info *module;
> - struct gbaudio_data_connection *data;
> + struct gbaudio_data_connection *data = NULL;
> struct gb_bundle *bundle;
> struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev);
> struct gbaudio_stream_params *params;
> @@ -498,7 +498,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream,
> {
> int ret;
> struct gbaudio_module_info *module;
> - struct gbaudio_data_connection *data;
> + struct gbaudio_data_connection *data = NULL;
> struct gb_bundle *bundle;
> struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev);
> struct gbaudio_stream_params *params;
> @@ -562,7 +562,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream,
> static int gbcodec_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
> {
> int ret;
> - struct gbaudio_data_connection *data;
> + struct gbaudio_data_connection *data = NULL;
> struct gbaudio_module_info *module;
> struct gb_bundle *bundle;
> struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev);
> --
> 2.17.1
>
Thanks Xiaomeng for sharing the fix.
Reviewed by: Vaibhav Agarwal <vaibhav.sr@...il.com>
Powered by blists - more mailing lists