2021-08-25 07:15:58

by kernel test robot

[permalink] [raw]
Subject: [smfrench-smb3-kernel:pr/65 143/143] fs/ksmbd/smb2pdu.c:5640:6: warning: variable 'user_ns' is used uninitialized whenever 'if' condition is true

tree: git://github.com/smfrench/smb3-kernel.git pr/65
head: 4b499755e1024f97e75411920a404b357af6e153
commit: 4b499755e1024f97e75411920a404b357af6e153 [143/143] ksmbd: fix lookup on idmapped mounts
config: hexagon-randconfig-r041-20210824 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d26000e4cc2bc65e207a84fa26cb6e374d60aa12)
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://github.com/smfrench/smb3-kernel/commit/4b499755e1024f97e75411920a404b357af6e153
git remote add smfrench-smb3-kernel git://github.com/smfrench/smb3-kernel.git
git fetch --no-tags smfrench-smb3-kernel pr/65
git checkout 4b499755e1024f97e75411920a404b357af6e153
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

fs/ksmbd/smb2pdu.c:3546:10: error: implicit declaration of function 'lookup_one' [-Werror,-Wimplicit-function-declaration]
dent = lookup_one(user_ns, priv->d_info->name,
^
fs/ksmbd/smb2pdu.c:3546:8: warning: incompatible integer to pointer conversion assigning to 'struct dentry *' from 'int' [-Wint-conversion]
dent = lookup_one(user_ns, priv->d_info->name,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/ksmbd/smb2pdu.c:5640:6: warning: variable 'user_ns' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (ksmbd_stream_fd(fp))
^~~~~~~~~~~~~~~~~~~
fs/ksmbd/smb2pdu.c:5662:31: note: uninitialized use occurs here
return smb2_rename(work, fp, user_ns,
^~~~~~~
fs/ksmbd/smb2pdu.c:5640:2: note: remove the 'if' if its condition is always false
if (ksmbd_stream_fd(fp))
^~~~~~~~~~~~~~~~~~~~~~~~
fs/ksmbd/smb2pdu.c:5629:32: note: initialize the variable 'user_ns' to silence this warning
struct user_namespace *user_ns;
^
= NULL
2 warnings and 1 error generated.


vim +5640 fs/ksmbd/smb2pdu.c

e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5625
64b39f4a2fd293 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-30 5626 static int set_rename_info(struct ksmbd_work *work, struct ksmbd_file *fp,
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5627 char *buf)
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5628 {
4b499755e1024f fs/ksmbd/smb2pdu.c Christian Brauner 2021-08-16 5629 struct user_namespace *user_ns;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5630 struct ksmbd_file *parent_fp;
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5631 struct dentry *parent;
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5632 struct dentry *dentry = fp->filp->f_path.dentry;
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5633 int ret;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5634
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5635 if (!(fp->daccess & FILE_DELETE_LE)) {
bde1694aecdb53 fs/cifsd/smb2pdu.c Namjae Jeon 2021-06-28 5636 pr_err("no right to delete : 0x%x\n", fp->daccess);
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5637 return -EACCES;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5638 }
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5639
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 @5640 if (ksmbd_stream_fd(fp))
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5641 goto next;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5642
4b499755e1024f fs/ksmbd/smb2pdu.c Christian Brauner 2021-08-16 5643 user_ns = file_mnt_user_ns(fp->filp);
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5644 parent = dget_parent(dentry);
4b499755e1024f fs/ksmbd/smb2pdu.c Christian Brauner 2021-08-16 5645 ret = ksmbd_vfs_lock_parent(user_ns, parent, dentry);
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5646 if (ret) {
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5647 dput(parent);
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5648 return ret;
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5649 }
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5650
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5651 parent_fp = ksmbd_lookup_fd_inode(d_inode(parent));
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5652 inode_unlock(d_inode(parent));
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5653 dput(parent);
12202c0594b182 fs/ksmbd/smb2pdu.c Namjae Jeon 2021-06-29 5654
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5655 if (parent_fp) {
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5656 if (parent_fp->daccess & FILE_DELETE_LE) {
bde1694aecdb53 fs/cifsd/smb2pdu.c Namjae Jeon 2021-06-28 5657 pr_err("parent dir is opened with delete access\n");
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5658 return -ESHARE;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5659 }
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5660 }
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5661 next:
4b499755e1024f fs/ksmbd/smb2pdu.c Christian Brauner 2021-08-16 5662 return smb2_rename(work, fp, user_ns,
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5663 (struct smb2_file_rename_info *)buf,
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5664 work->sess->conn->local_nls);
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5665 }
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 5666

:::::: The code at line 5640 was first introduced by commit
:::::: e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9 cifsd: add server-side procedures for SMB3

:::::: TO: Namjae Jeon <[email protected]>
:::::: CC: Steve French <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (6.65 kB)
.config.gz (25.26 kB)
Download all attachments

2021-08-25 08:21:53

by Christian Brauner

[permalink] [raw]
Subject: Re: [smfrench-smb3-kernel:pr/65 143/143] fs/ksmbd/smb2pdu.c:5640:6: warning: variable 'user_ns' is used uninitialized whenever 'if' condition is true

On Wed, Aug 25, 2021 at 03:14:01PM +0800, kernel test robot wrote:
> tree: git://github.com/smfrench/smb3-kernel.git pr/65
> head: 4b499755e1024f97e75411920a404b357af6e153
> commit: 4b499755e1024f97e75411920a404b357af6e153 [143/143] ksmbd: fix lookup on idmapped mounts
> config: hexagon-randconfig-r041-20210824 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d26000e4cc2bc65e207a84fa26cb6e374d60aa12)
> 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://github.com/smfrench/smb3-kernel/commit/4b499755e1024f97e75411920a404b357af6e153
> git remote add smfrench-smb3-kernel git://github.com/smfrench/smb3-kernel.git
> git fetch --no-tags smfrench-smb3-kernel pr/65
> git checkout 4b499755e1024f97e75411920a404b357af6e153
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <[email protected]>

Thanks for the report but this is outdated and requires a patch that
sits in David Sterba's for-next tree. So this is safe to ignore.
Feels like this probably should only go to the authors, kbuild-all and
clang-built-linux lists similar to what the intel built bot does.
Otherwise this generates a lot of unneeded noise. Just my 2 cents.

Christian

2021-08-26 00:35:16

by Chen, Rong A

[permalink] [raw]
Subject: Re: [kbuild-all] Re: [smfrench-smb3-kernel:pr/65 143/143] fs/ksmbd/smb2pdu.c:5640:6: warning: variable 'user_ns' is used uninitialized whenever 'if' condition is true



On 8/25/21 4:20 PM, Christian Brauner wrote:
> On Wed, Aug 25, 2021 at 03:14:01PM +0800, kernel test robot wrote:
>> tree: git://github.com/smfrench/smb3-kernel.git pr/65
>> head: 4b499755e1024f97e75411920a404b357af6e153
>> commit: 4b499755e1024f97e75411920a404b357af6e153 [143/143] ksmbd: fix lookup on idmapped mounts
>> config: hexagon-randconfig-r041-20210824 (attached as .config)
>> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d26000e4cc2bc65e207a84fa26cb6e374d60aa12)
>> 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://github.com/smfrench/smb3-kernel/commit/4b499755e1024f97e75411920a404b357af6e153
>> git remote add smfrench-smb3-kernel git://github.com/smfrench/smb3-kernel.git
>> git fetch --no-tags smfrench-smb3-kernel pr/65
>> git checkout 4b499755e1024f97e75411920a404b357af6e153
>> # save the attached .config to linux build tree
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <[email protected]>
> Thanks for the report but this is outdated and requires a patch that
> sits in David Sterba's for-next tree. So this is safe to ignore.
> Feels like this probably should only go to the authors, kbuild-all and
> clang-built-linux lists similar to what the intel built bot does.
> Otherwise this generates a lot of unneeded noise. Just my 2 cents.
>
> Christian

Hi Christian,

Thanks for the advice, we'll send the reports to the tree's owner (Steve
French) next time.

Best Regards,
Rong Chen