[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201204083624.2711356-1-arnd@kernel.org>
Date: Fri, 4 Dec 2020 09:36:11 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: 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>,
Tzung-Bi Shih <tzungbi@...gle.com>
Cc: 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-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: [PATCH] [v2] ASoC: cros_ec_codec: fix uninitialized memory read
From: Arnd Bergmann <arnd@...db.de>
gcc points out a memory area that is copied to a device
but not initialized:
sound/soc/codecs/cros_ec_codec.c: In function 'i2s_rx_event':
arch/x86/include/asm/string_32.h:83:20: error: '*((void *)&p+4)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
83 | *((int *)to + 1) = *((int *)from + 1);
Change the length of the command to only pass down the
part of the structure that has been initialized, as
Tzung-Bi Shih explains that only that member is meant to
be used.
Cc: Tzung-Bi Shih <tzungbi@...gle.com>
Fixes: 727f1c71c780 ("ASoC: cros_ec_codec: refactor I2S RX")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
sound/soc/codecs/cros_ec_codec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
}
static struct snd_soc_dapm_widget i2s_rx_dapm_widgets[] = {
--
2.27.0
Powered by blists - more mailing lists