[gustavoars-linux:testing/uapi/nfsd/nfsfh 1/2] drivers/media/pci/ngene/ngene-core.c:388:2: warning: 'memcpy' offset [12, 16] from the object at 'com' is out of the bounds of referenced subobject 'config' with type 'unsigned char' at offset 10

From: kernel test robot
Date: Tue Feb 09 2021 - 20:11:55 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/uapi/nfsd/nfsfh
head: d28670226e028e65b0de5e6744c5df188fc2728b
commit: 5c976c3f03be89378ca672c1a3c7ce7048d90606 [1/2] Makefile: Enable -Warray-bounds
config: riscv-randconfig-r004-20210209 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=5c976c3f03be89378ca672c1a3c7ce7048d90606
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux testing/uapi/nfsd/nfsfh
git checkout 5c976c3f03be89378ca672c1a3c7ce7048d90606
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/media/pci/ngene/ngene-core.c: In function 'ngene_command_config_free_buf':
>> drivers/media/pci/ngene/ngene-core.c:388:2: warning: 'memcpy' offset [12, 16] from the object at 'com' is out of the bounds of referenced subobject 'config' with type 'unsigned char' at offset 10 [-Warray-bounds]
388 | memcpy(&com.cmd.ConfigureBuffers.config, config, 6);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +388 drivers/media/pci/ngene/ngene-core.c

dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 381
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 382 static int ngene_command_config_free_buf(struct ngene *dev, u8 *config)
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 383 {
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 384 struct ngene_command com;
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 385
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 386 com.cmd.hdr.Opcode = CMD_CONFIGURE_FREE_BUFFER;
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 387 com.cmd.hdr.Length = 6;
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 @388 memcpy(&com.cmd.ConfigureBuffers.config, config, 6);
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 389 com.in_len = 6;
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 390 com.out_len = 0;
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 391
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 392 if (ngene_command(dev, &com) < 0)
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 393 return -EIO;
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 394
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 395 return 0;
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 396 }
dae52d009fc950 drivers/media/dvb/ngene/ngene-core.c Matthias Benesch 2009-12-18 397

:::::: The code at line 388 was first introduced by commit
:::::: dae52d009fc950b5c209260d50fcc000f5becd3c V4L/DVB: ngene: Initial check-in

:::::: TO: Matthias Benesch <twoof7@xxxxxxxxxx>
:::::: CC: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip