sound/soc/codecs/hdmi-codec.c:504 hdmi_codec_hw_params() error: __builtin_memcpy() 'hcp->iec_status' too small (5 vs 24)
PATCH 11/13 sound/soc/codecs/hdmi-codec.c:504 hdmi_codec_hw_params() error: __builtin_memcpy() 'hcp->iec_status' too small (5 vs 24)
tree: https://android.googlesource.com/kernel/common android12-5.10 head: 44817294cfe4afa710fc37d3fe6953877a4232e0 commit: 4ad97b395f94bc0f546f27bbe9b8a62321f49ad3 [11/13] UPSTREAM: ASoC: hdmi-codec: Add iec958 controls config: i386-randconfig-141-20240214 (https://download.01.org/0day-ci/archive/20240218/[email protected]/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:sound/soc/codecs/hdmi-codec.c:504 hdmi_codec_hw_params() error: __builtin_memcpy() 'hcp->iec_status' too small (5 vs 24)
vim +504 sound/soc/codecs/hdmi-codec.c
09184118a8abae Jyri Sarha 2016-03-31 484 static int hdmi_codec_hw_params(struct snd_pcm_substream *substream,
09184118a8abae Jyri Sarha 2016-03-31 485 struct snd_pcm_hw_params *params,
09184118a8abae Jyri Sarha 2016-03-31 486 struct snd_soc_dai *dai)
09184118a8abae Jyri Sarha 2016-03-31 487 {
09184118a8abae Jyri Sarha 2016-03-31 488 struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
0cf4610b9f297e Jerome Brunet 2019-05-06 489 struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
09184118a8abae Jyri Sarha 2016-03-31 490 struct hdmi_codec_params hp = {
09184118a8abae Jyri Sarha 2016-03-31 491 .iec = {
09184118a8abae Jyri Sarha 2016-03-31 492 .status = { 0 },
09184118a8abae Jyri Sarha 2016-03-31 493 .subcode = { 0 },
09184118a8abae Jyri Sarha 2016-03-31 494 .pad = 0,
09184118a8abae Jyri Sarha 2016-03-31 495 .dig_subframe = { 0 },
09184118a8abae Jyri Sarha 2016-03-31 496 }
09184118a8abae Jyri Sarha 2016-03-31 497 };
cd6111b26280a2 Arnaud Pouliquen 2017-01-03 498 int ret, idx;
09184118a8abae Jyri Sarha 2016-03-31 499
09184118a8abae Jyri Sarha 2016-03-31 500 dev_dbg(dai->dev, "%s() width %d rate %d channels %d\n", __func__,
09184118a8abae Jyri Sarha 2016-03-31 501 params_width(params), params_rate(params),
09184118a8abae Jyri Sarha 2016-03-31 502 params_channels(params));
09184118a8abae Jyri Sarha 2016-03-31 503
4ad97b395f94bc Maxime Ripard 2021-05-25 @504 memcpy(hp.iec.status, hcp->iec_status, sizeof(hp.iec.status));hp.iec.status is 24 bytes and hcp->iec_status is 5 bytes so it reads beyond the end of the hcp struct.
4ad97b395f94bc Maxime Ripard 2021-05-25 505 ret = snd_pcm_fill_iec958_consumer_hw_params(params, hp.iec.status,
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki