Re: [PATCH] ASoC: cros_ec_codec: fix uninitialized memory read

From: Tzung-Bi Shih
Date: Fri Dec 04 2020 - 04:06:58 EST


On Fri, Dec 4, 2020 at 4:28 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> On Fri, Dec 4, 2020 at 3:56 AM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote:
> >
> > On Fri, Dec 4, 2020 at 6:55 AM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> >
> > In the case in i2s_rx_event(), only the "cmd" member is used. But it
> > is fine to please the compiler.
>
> I wouldn't do it just to please the compiler. I sent this patch since
> the code clearly copies the uninitialized data here. If only
> one byte is meant to be copied, then we should change the
> function call to not pass the entire structure. I'll send a new
> patch for that.

My sentence may confuse you. But I mean: the uninitialized data
doesn't introduce any bugs because it only uses the first byte in the
case.

Instead of your v2
(https://patchwork.kernel.org/project/alsa-devel/patch/20201204083624.2711356-1-arnd@xxxxxxxxxx/),
I prefer this version v1.