Skip to contentSkip to conversation

fs/ceph/super.c:1042 ceph_umount_begin() warn: variable dereferenced before check 'fsc' (see line 1041)

PATCH In review Dan Carpenter 2 participants 2 messages Mar 28, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 19/40 fs/ceph/super.c:1042 ceph_umount_begin() warn: variable dereferenced before check 'fsc' (see line 1041)

tree:   https://github.com/ceph/ceph-client.git tls_logger
head:   3d957afa4285ed4deaaf42d200ba7ee1f3092f8d
commit: 75b56e556ea415e29a13a8b7e98d302fbbec4c01 [19/40] cephsan new logger
config: x86_64-randconfig-r071-20250328 (https://download.01.org/0day-ci/archive/20250328/[email protected]/config)
compiler: clang version 20.1.1 (https://github.com/llvm/llvm-project 424c2d9b7e4de40d0804dd374721e6411c27d1d1)

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:
fs/ceph/super.c:1042 ceph_umount_begin() warn: variable dereferenced before check 'fsc' (see line 1041)

vim +/fsc +1042 fs/ceph/super.c

631ed4b0828727 Jeff Layton  2021-10-14  1037  void ceph_umount_begin(struct super_block *sb)
16725b9d2a2e3d Sage Weil    2009-10-06  1038  {
5995d90d2d19f3 Xiubo Li     2023-06-12  1039  	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
3d14c5d2b6e15c Yehuda Sadeh 2010-04-06  1040  
38d46409c4639a Xiubo Li     2023-06-12 @1041  	doutc(fsc->client, "starting forced umount\n");
                                                      ^^^^^^^^^^^

Dereferenced

3d14c5d2b6e15c Yehuda Sadeh 2010-04-06 @1042 if (!fsc)

                                                    ^^^^

Checked too late.

3d14c5d2b6e15c Yehuda Sadeh 2010-04-06  1043  		return;
3d14c5d2b6e15c Yehuda Sadeh 2010-04-06  1044  	fsc->mount_state = CEPH_MOUNT_SHUTDOWN;
50c9132ddfb202 Jeff Layton  2020-09-25  1045  	__ceph_umount_begin(fsc);
16725b9d2a2e3d Sage Weil    2009-10-06  1046  }
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 23 lines · Dan Carpenter
tree:   https://github.com/ceph/ceph-client.git   tls_logger
head:   3d957afa4285ed4deaaf42d200ba7ee1f3092f8d
commit: 75b56e556ea415e29a13a8b7e98d302fbbec4c01 [19/40] cephsan new logger
config: x86_64-randconfig-r071-20250328 (https://download.01.org/0day-ci/archive/20250328/[email protected]/config  )
compiler: clang version 20.1.1 (https://github.com/llvm/llvm-project   424c2d9b7e4de40d0804dd374721e6411c27d1d1)

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

Quoted 3 lines

smatch warnings:
fs/ceph/super.c:1042 ceph_umount_begin() warn: variable dereferenced before check 'fsc' (see line 1041)

vim +/fsc +1042 fs/ceph/super.c

631ed4b0828727 Jeff Layton  2021-10-14  1037  void ceph_umount_begin(struct super_block *sb)
16725b9d2a2e3d Sage Weil    2009-10-06  1038  {
5995d90d2d19f3 Xiubo Li     2023-06-12  1039  	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
3d14c5d2b6e15c Yehuda Sadeh 2010-04-06  1040  
38d46409c4639a Xiubo Li     2023-06-12 @1041  	doutc(fsc->client, "starting forced umount\n");
                                                      ^^^^^^^^^^^
Quoted 6 lines

Dereferenced

3d14c5d2b6e15c Yehuda Sadeh 2010-04-06 @1042 if (!fsc)

                                                    ^^^^

Checked too late.

Yeah, makes sense. Let me fix it.

Thanks,
Slava.

Quoted 5 lines
3d14c5d2b6e15c Yehuda Sadeh 2010-04-06  1043  		return;
3d14c5d2b6e15c Yehuda Sadeh 2010-04-06  1044  	fsc->mount_state = CEPH_MOUNT_SHUTDOWN;
50c9132ddfb202 Jeff Layton  2020-09-25  1045  	__ceph_umount_begin(fsc);
16725b9d2a2e3d Sage Weil    2009-10-06  1046  }