fs/fuse/virtio_fs.c:604:9: warning: 'strncpy' specified bound 24 equals destination size

From: kernel test robot
Date: Mon Sep 27 2021 - 15:32:49 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 92477dd1faa650e50bd3bb35a6c0b8d09198cc35
commit: b43b7e81eb2b188fab1d8bc334b4b725f6d2ae10 virtiofs: provide a helper function for virtqueue initialization
date: 1 year, 1 month ago
config: arm-randconfig-r025-20210927 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.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/torvalds/linux.git/commit/?id=b43b7e81eb2b188fab1d8bc334b4b725f6d2ae10
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b43b7e81eb2b188fab1d8bc334b4b725f6d2ae10
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm

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

All warnings (new ones prefixed by >>):

fs/fuse/virtio_fs.c: In function 'virtio_fs_init_vq':
>> fs/fuse/virtio_fs.c:604:9: warning: 'strncpy' specified bound 24 equals destination size [-Wstringop-truncation]
604 | strncpy(fsvq->name, name, VQ_NAME_LEN);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +604 fs/fuse/virtio_fs.c

600
601 static void virtio_fs_init_vq(struct virtio_fs_vq *fsvq, char *name,
602 int vq_type)
603 {
> 604 strncpy(fsvq->name, name, VQ_NAME_LEN);
605 spin_lock_init(&fsvq->lock);
606 INIT_LIST_HEAD(&fsvq->queued_reqs);
607 INIT_LIST_HEAD(&fsvq->end_reqs);
608 init_completion(&fsvq->in_flight_zero);
609
610 if (vq_type == VQ_REQUEST) {
611 INIT_WORK(&fsvq->done_work, virtio_fs_requests_done_work);
612 INIT_DELAYED_WORK(&fsvq->dispatch_work,
613 virtio_fs_request_dispatch_work);
614 } else {
615 INIT_WORK(&fsvq->done_work, virtio_fs_hiprio_done_work);
616 INIT_DELAYED_WORK(&fsvq->dispatch_work,
617 virtio_fs_hiprio_dispatch_work);
618 }
619 }
620

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

Attachment: .config.gz
Description: application/gzip