[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+Px+wVYCp=x1_zPkmgd3LLYH=wp1yYHCHZbuT4ecMgPCuYXMA@mail.gmail.com>
Date: Fri, 4 Dec 2020 16:57:45 +0800
From: Tzung-Bi Shih <tzungbi@...gle.com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Cheng-Yi Chiang <cychiang@...omium.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Benson Leung <bleung@...omium.org>,
Enric Balletbo i Serra <enric.balletbo@...labora.com>,
Arnd Bergmann <arnd@...db.de>,
Guenter Roeck <groeck@...omium.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
Ard Biesheuvel <ardb@...nel.org>,
Eric Biggers <ebiggers@...gle.com>,
Yu-Hsuan Hsu <yuhsuan@...omium.org>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
ALSA development <alsa-devel@...a-project.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] [v2] ASoC: cros_ec_codec: fix uninitialized memory read
On Fri, Dec 4, 2020 at 4:36 PM Arnd Bergmann <arnd@...nel.org> wrote:
> diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c
> index 58894bf47514..6ec673573c70 100644
> --- a/sound/soc/codecs/cros_ec_codec.c
> +++ b/sound/soc/codecs/cros_ec_codec.c
> @@ -348,7 +348,7 @@ static int i2s_rx_event(struct snd_soc_dapm_widget *w,
> }
>
> return send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC_I2S_RX,
> - (uint8_t *)&p, sizeof(p), NULL, 0);
> + &p.cmd, sizeof(p.cmd), NULL, 0);
> }
I would prefer your v1.
Reasons:
1. The change is not just kernel related.
There is a EC (embedded controller) firmware to collaborate with the
code. The firmware doesn't know the kernel only copies the first byte
of the packet (at least for now). See
https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/common/audio_codec_i2s_rx.c#120.
2. We don't copy partial packets in a EC host command.
IMHO, it is also not a big deal if copying a few unused bytes in the packet.
Powered by blists - more mailing lists