From: kernel test robot <lkp@intel.com> To: Stefan Hajnoczi <stefanha@redhat.com> Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Miklos Szeredi <mszeredi@redhat.com>, Vivek Goyal <vgoyal@redhat.com> Subject: fs/fuse/virtio_fs.c:1009:6: warning: Variable 'err' is reassigned a value before the old one has been used. Date: Thu, 6 Aug 2020 14:04:18 +0800 [thread overview] Message-ID: <202008061415.sHRFePnn%lkp@intel.com> (raw) tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: fffe3ae0ee84e25d2befe2ae59bc32aa2b6bc77b commit: a62a8ef9d97da23762a588592c8b8eb50a8deb6a virtio-fs: add virtiofs filesystem date: 11 months ago compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> cppcheck warnings: (new ones prefixed by >>) >> fs/fuse/virtio_fs.c:1009:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment] err = -ENOMEM; ^ fs/fuse/virtio_fs.c:1003:6: note: Variable 'err' is reassigned a value before the old one has been used. err = -EINVAL; ^ fs/fuse/virtio_fs.c:1009:6: note: Variable 'err' is reassigned a value before the old one has been used. err = -ENOMEM; ^ fs/fuse/virtio_fs.c:1020:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment] err = fuse_fill_super_common(sb, &ctx); ^ fs/fuse/virtio_fs.c:1009:6: note: Variable 'err' is reassigned a value before the old one has been used. err = -ENOMEM; ^ fs/fuse/virtio_fs.c:1020:6: note: Variable 'err' is reassigned a value before the old one has been used. err = fuse_fill_super_common(sb, &ctx); ^ vim +/err +1009 fs/fuse/virtio_fs.c 979 980 static int virtio_fs_fill_super(struct super_block *sb) 981 { 982 struct fuse_conn *fc = get_fuse_conn_super(sb); 983 struct virtio_fs *fs = fc->iq.priv; 984 unsigned int i; 985 int err; 986 struct fuse_fs_context ctx = { 987 .rootmode = S_IFDIR, 988 .default_permissions = 1, 989 .allow_other = 1, 990 .max_read = UINT_MAX, 991 .blksize = 512, 992 .destroy = true, 993 .no_control = true, 994 .no_force_umount = true, 995 }; 996 997 mutex_lock(&virtio_fs_mutex); 998 999 /* After holding mutex, make sure virtiofs device is still there. 1000 * Though we are holding a reference to it, drive ->remove might 1001 * still have cleaned up virtual queues. In that case bail out. 1002 */ 1003 err = -EINVAL; 1004 if (list_empty(&fs->list)) { 1005 pr_info("virtio-fs: tag <%s> not found\n", fs->tag); 1006 goto err; 1007 } 1008 > 1009 err = -ENOMEM; 1010 /* Allocate fuse_dev for hiprio and notification queues */ 1011 for (i = 0; i < VQ_REQUEST; i++) { 1012 struct virtio_fs_vq *fsvq = &fs->vqs[i]; 1013 1014 fsvq->fud = fuse_dev_alloc(); 1015 if (!fsvq->fud) 1016 goto err_free_fuse_devs; 1017 } 1018 1019 ctx.fudptr = (void **)&fs->vqs[VQ_REQUEST].fud; 1020 err = fuse_fill_super_common(sb, &ctx); 1021 if (err < 0) 1022 goto err_free_fuse_devs; 1023 1024 fc = fs->vqs[VQ_REQUEST].fud->fc; 1025 1026 for (i = 0; i < fs->nvqs; i++) { 1027 struct virtio_fs_vq *fsvq = &fs->vqs[i]; 1028 1029 if (i == VQ_REQUEST) 1030 continue; /* already initialized */ 1031 fuse_dev_install(fsvq->fud, fc); 1032 } 1033 1034 /* Previous unmount will stop all queues. Start these again */ 1035 virtio_fs_start_all_queues(fs); 1036 fuse_send_init(fc); 1037 mutex_unlock(&virtio_fs_mutex); 1038 return 0; 1039 1040 err_free_fuse_devs: 1041 virtio_fs_free_devs(fs); 1042 err: 1043 mutex_unlock(&virtio_fs_mutex); 1044 return err; 1045 } 1046 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com> To: kbuild-all@lists.01.org Subject: fs/fuse/virtio_fs.c:1009:6: warning: Variable 'err' is reassigned a value before the old one has been used. Date: Thu, 06 Aug 2020 14:04:18 +0800 [thread overview] Message-ID: <202008061415.sHRFePnn%lkp@intel.com> (raw) [-- Attachment #1: Type: text/plain, Size: 3680 bytes --] tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: fffe3ae0ee84e25d2befe2ae59bc32aa2b6bc77b commit: a62a8ef9d97da23762a588592c8b8eb50a8deb6a virtio-fs: add virtiofs filesystem date: 11 months ago compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> cppcheck warnings: (new ones prefixed by >>) >> fs/fuse/virtio_fs.c:1009:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment] err = -ENOMEM; ^ fs/fuse/virtio_fs.c:1003:6: note: Variable 'err' is reassigned a value before the old one has been used. err = -EINVAL; ^ fs/fuse/virtio_fs.c:1009:6: note: Variable 'err' is reassigned a value before the old one has been used. err = -ENOMEM; ^ fs/fuse/virtio_fs.c:1020:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment] err = fuse_fill_super_common(sb, &ctx); ^ fs/fuse/virtio_fs.c:1009:6: note: Variable 'err' is reassigned a value before the old one has been used. err = -ENOMEM; ^ fs/fuse/virtio_fs.c:1020:6: note: Variable 'err' is reassigned a value before the old one has been used. err = fuse_fill_super_common(sb, &ctx); ^ vim +/err +1009 fs/fuse/virtio_fs.c 979 980 static int virtio_fs_fill_super(struct super_block *sb) 981 { 982 struct fuse_conn *fc = get_fuse_conn_super(sb); 983 struct virtio_fs *fs = fc->iq.priv; 984 unsigned int i; 985 int err; 986 struct fuse_fs_context ctx = { 987 .rootmode = S_IFDIR, 988 .default_permissions = 1, 989 .allow_other = 1, 990 .max_read = UINT_MAX, 991 .blksize = 512, 992 .destroy = true, 993 .no_control = true, 994 .no_force_umount = true, 995 }; 996 997 mutex_lock(&virtio_fs_mutex); 998 999 /* After holding mutex, make sure virtiofs device is still there. 1000 * Though we are holding a reference to it, drive ->remove might 1001 * still have cleaned up virtual queues. In that case bail out. 1002 */ 1003 err = -EINVAL; 1004 if (list_empty(&fs->list)) { 1005 pr_info("virtio-fs: tag <%s> not found\n", fs->tag); 1006 goto err; 1007 } 1008 > 1009 err = -ENOMEM; 1010 /* Allocate fuse_dev for hiprio and notification queues */ 1011 for (i = 0; i < VQ_REQUEST; i++) { 1012 struct virtio_fs_vq *fsvq = &fs->vqs[i]; 1013 1014 fsvq->fud = fuse_dev_alloc(); 1015 if (!fsvq->fud) 1016 goto err_free_fuse_devs; 1017 } 1018 1019 ctx.fudptr = (void **)&fs->vqs[VQ_REQUEST].fud; 1020 err = fuse_fill_super_common(sb, &ctx); 1021 if (err < 0) 1022 goto err_free_fuse_devs; 1023 1024 fc = fs->vqs[VQ_REQUEST].fud->fc; 1025 1026 for (i = 0; i < fs->nvqs; i++) { 1027 struct virtio_fs_vq *fsvq = &fs->vqs[i]; 1028 1029 if (i == VQ_REQUEST) 1030 continue; /* already initialized */ 1031 fuse_dev_install(fsvq->fud, fc); 1032 } 1033 1034 /* Previous unmount will stop all queues. Start these again */ 1035 virtio_fs_start_all_queues(fs); 1036 fuse_send_init(fc); 1037 mutex_unlock(&virtio_fs_mutex); 1038 return 0; 1039 1040 err_free_fuse_devs: 1041 virtio_fs_free_devs(fs); 1042 err: 1043 mutex_unlock(&virtio_fs_mutex); 1044 return err; 1045 } 1046 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next reply other threads:[~2020-08-06 11:04 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-06 6:04 kernel test robot [this message] 2020-08-06 6:04 ` fs/fuse/virtio_fs.c:1009:6: warning: Variable 'err' is reassigned a value before the old one has been used kernel test robot 2020-08-06 17:40 ` Vivek Goyal 2020-08-06 17:40 ` Vivek Goyal 2020-08-10 9:24 ` [kbuild-all] " Xia, Hui 2020-08-10 9:24 ` Xia, Hui
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=202008061415.sHRFePnn%lkp@intel.com \ --to=lkp@intel.com \ --cc=kbuild-all@lists.01.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mszeredi@redhat.com \ --cc=stefanha@redhat.com \ --cc=vgoyal@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.