sound/i2c/other/ak4xxx-adda.c:75 ak4529_reset() error: buffer overflow 'ak->images' 64 <= 255

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: "Cássio Gabriel" <[email protected]>
CC: Takashi Iwai <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f5bbbfec59b4e2fb7520a91de3df8a6174325d6a
commit: 66f6f543283e91b8899b0dd109d8f15a529e8464 ALSA: i2c: ak4xxx-adda: implement AK4529 reset handling
date:   4 months ago
:::::: branch date: 31 hours ago
:::::: commit date: 4 months ago
config: x86_64-randconfig-161 (https://download.01.org/0day-ci/archive/20260813/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb

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
| Fixes: 66f6f543283e ("ALSA: i2c: ak4xxx-adda: implement AK4529 reset handling")
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
sound/i2c/other/ak4xxx-adda.c:75 ak4529_reset() error: buffer overflow 'ak->images' 64 <= 255

Old smatch warnings:
sound/i2c/other/ak4xxx-adda.c:93 ak435X_reset() error: buffer overflow 'ak->images' 64 <= 255

vim +75 sound/i2c/other/ak4xxx-adda.c

cb9d24e4349013 Takashi Iwai   2006-06-27  55  
66f6f543283e91 Cássio Gabriel 2026-04-07  56  /* reset procedure for AK4529 */
66f6f543283e91 Cássio Gabriel 2026-04-07  57  static void ak4529_reset(struct snd_akm4xxx *ak, int state)
66f6f543283e91 Cássio Gabriel 2026-04-07  58  {
66f6f543283e91 Cássio Gabriel 2026-04-07  59  	static const unsigned char regs[] = {
66f6f543283e91 Cássio Gabriel 2026-04-07  60  		0x0a, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
66f6f543283e91 Cássio Gabriel 2026-04-07  61  		0x06, 0x07, 0x0b, 0x0c, 0x08,
66f6f543283e91 Cássio Gabriel 2026-04-07  62  	};
66f6f543283e91 Cássio Gabriel 2026-04-07  63  	unsigned int i;
66f6f543283e91 Cássio Gabriel 2026-04-07  64  	unsigned char reg;
66f6f543283e91 Cássio Gabriel 2026-04-07  65  
66f6f543283e91 Cássio Gabriel 2026-04-07  66  	if (state) {
66f6f543283e91 Cássio Gabriel 2026-04-07  67  		snd_akm4xxx_write(ak, 0, 0x09,
66f6f543283e91 Cássio Gabriel 2026-04-07  68  				  snd_akm4xxx_get(ak, 0, 0x09) & ~0x01);
66f6f543283e91 Cássio Gabriel 2026-04-07  69  		return;
66f6f543283e91 Cássio Gabriel 2026-04-07  70  	}
66f6f543283e91 Cássio Gabriel 2026-04-07  71  
66f6f543283e91 Cássio Gabriel 2026-04-07  72  	for (i = 0; i < ARRAY_SIZE(regs); i++) {
66f6f543283e91 Cássio Gabriel 2026-04-07  73  		reg = regs[i];
66f6f543283e91 Cássio Gabriel 2026-04-07  74  		snd_akm4xxx_write(ak, 0, reg,
66f6f543283e91 Cássio Gabriel 2026-04-07 @75  				  snd_akm4xxx_get(ak, 0, reg));
66f6f543283e91 Cássio Gabriel 2026-04-07  76  	}
66f6f543283e91 Cássio Gabriel 2026-04-07  77  	snd_akm4xxx_write(ak, 0, 0x09,
66f6f543283e91 Cássio Gabriel 2026-04-07  78  			  snd_akm4xxx_get(ak, 0, 0x09) | 0x01);
66f6f543283e91 Cássio Gabriel 2026-04-07  79  }
66f6f543283e91 Cássio Gabriel 2026-04-07  80  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.