fs/smb/client/cifsacl.c:1514 set_cifs_acl() error: uninitialized symbol 'access_flags'.
PATCH 20/48 fs/smb/client/cifsacl.c:1514 set_cifs_acl() error: uninitialized symbol 'access_flags'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git cifs head: cc26137de51202e7210b058f6696393f1e006d46 commit: ce9f9c0511bbb913daa982afed5859ab68adf0e8 [20/48] cifs: Fix getting and setting SACLs over SMB1 config: riscv-randconfig-r072-20241228 (https://download.01.org/0day-ci/archive/20241228/[email protected]/config) compiler: riscv64-linux-gcc (GCC) 14.2.0
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/smb/client/cifsacl.c:1514 set_cifs_acl() error: uninitialized symbol 'access_flags'.
vim +/access_flags +1514 fs/smb/client/cifsacl.c
3651487607ae77 fs/smb/client/cifsacl.c ChenXiaoSong 2024-08-22 1486 int set_cifs_acl(struct smb_ntsd *pnntsd, __u32 acllen,
a5ff376966c079 fs/cifs/cifsacl.c Shirish Pargaonkar 2011-10-13 1487 struct inode *inode, const char *path, int aclflag)
b96d31a62f7145 fs/cifs/cifsacl.c Christoph Hellwig 2009-05-27 1488 {
b96d31a62f7145 fs/cifs/cifsacl.c Christoph Hellwig 2009-05-27 1489 int oplock = 0;
6d5786a34d98bf fs/cifs/cifsacl.c Pavel Shilovsky 2012-06-20 1490 unsigned int xid;
0f060936e490c6 fs/cifs/cifsacl.c Amir Goldstein 2020-02-03 1491 int rc, access_flags;
96daf2b09178d8 fs/cifs/cifsacl.c Steve French 2011-05-27 1492 struct cifs_tcon *tcon;
a5ff376966c079 fs/cifs/cifsacl.c Shirish Pargaonkar 2011-10-13 1493 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1494 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
d81b8a40e2ece0 fs/cifs/cifsacl.c Pavel Shilovsky 2014-01-16 1495 struct cifs_fid fid;
d81b8a40e2ece0 fs/cifs/cifsacl.c Pavel Shilovsky 2014-01-16 1496 struct cifs_open_parms oparms;
7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1497
7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1498 if (IS_ERR(tlink))
7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1499 return PTR_ERR(tlink);
97837582bc1e19 fs/cifs/cifsacl.c Steve French 2007-12-31 1500
7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1501 tcon = tlink_tcon(tlink);
6d5786a34d98bf fs/cifs/cifsacl.c Pavel Shilovsky 2012-06-20 1502 xid = get_xid();
97837582bc1e19 fs/cifs/cifsacl.c Steve French 2007-12-31 1503
ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1504 if (aclflag & CIFS_ACL_OWNER || aclflag & CIFS_ACL_GROUP)
ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1505 access_flags |= WRITE_OWNER;
ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1506 if (aclflag & CIFS_ACL_SACL)
ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1507 access_flags |= SYSTEM_SECURITY;
ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1508 if (aclflag & CIFS_ACL_DACL)
ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1509 access_flags |= WRITE_DAC;What if the permisions are 000?
a5ff376966c079 fs/cifs/cifsacl.c Shirish Pargaonkar 2011-10-13 1510
de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1511 oparms = (struct cifs_open_parms) {
de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1512 .tcon = tcon,
de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1513 .cifs_sb = cifs_sb,
de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 @1514 .desired_access = access_flags,
^^^^^^^^^^^^warning
de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1515 .create_options = cifs_create_options(cifs_sb, 0), de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1516 .disposition = FILE_OPEN, de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1517 .path = path, de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1518 .fid = &fid,
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 6 lines · On Monday 06 January 2025 13:46:56 Dan Carpenter wrote:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git cifs head: cc26137de51202e7210b058f6696393f1e006d46 commit: ce9f9c0511bbb913daa982afed5859ab68adf0e8 [20/48] cifs: Fix getting and setting SACLs over SMB1 config: riscv-randconfig-r072-20241228 (https://download.01.org/0day-ci/archive/20241228/[email protected]/config) compiler: riscv64-linux-gcc (GCC) 14.2.0
Quoted 8 lines
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/smb/client/cifsacl.c:1514set_cifs_acl()error: uninitialized symbol 'access_flags'.
Hello, I have already figured it out and wrote to the list:
https://lore.kernel.org/linux-cifs/20241227144343.volpdup7xx6xlsiq@pali/T/#u
Quoted 27 lines
vim +/access_flags +1514
fs/smb/client/cifsacl.c3651487607ae77 fs/smb/client/cifsacl.c ChenXiaoSong 2024-08-22 1486 int set_cifs_acl(struct smb_ntsd *pnntsd, __u32 acllen, a5ff376966c079 fs/cifs/cifsacl.c Shirish Pargaonkar 2011-10-13 1487 struct inode *inode, const char *path, int aclflag) b96d31a62f7145 fs/cifs/cifsacl.c Christoph Hellwig 2009-05-27 1488 { b96d31a62f7145 fs/cifs/cifsacl.c Christoph Hellwig 2009-05-27 1489 int oplock = 0; 6d5786a34d98bf fs/cifs/cifsacl.c Pavel Shilovsky 2012-06-20 1490 unsigned int xid; 0f060936e490c6 fs/cifs/cifsacl.c Amir Goldstein 2020-02-03 1491 int rc, access_flags; 96daf2b09178d8 fs/cifs/cifsacl.c Steve French 2011-05-27 1492 struct cifs_tcon *tcon; a5ff376966c079 fs/cifs/cifsacl.c Shirish Pargaonkar 2011-10-13 1493 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1494 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); d81b8a40e2ece0 fs/cifs/cifsacl.c Pavel Shilovsky 2014-01-16 1495 struct cifs_fid fid; d81b8a40e2ece0 fs/cifs/cifsacl.c Pavel Shilovsky 2014-01-16 1496 struct cifs_open_parms oparms; 7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1497 7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1498 if (IS_ERR(tlink)) 7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1499 return PTR_ERR(tlink); 97837582bc1e19 fs/cifs/cifsacl.c Steve French 2007-12-31 1500 7ffec372458d16 fs/cifs/cifsacl.c Jeff Layton 2010-09-29 1501 tcon = tlink_tcon(tlink); 6d5786a34d98bf fs/cifs/cifsacl.c Pavel Shilovsky 2012-06-20 1502 xid = get_xid(); 97837582bc1e19 fs/cifs/cifsacl.c Steve French 2007-12-31 1503 ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1504 if (aclflag & CIFS_ACL_OWNER || aclflag & CIFS_ACL_GROUP) ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1505 access_flags |= WRITE_OWNER; ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1506 if (aclflag & CIFS_ACL_SACL) ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1507 access_flags |= SYSTEM_SECURITY; ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1508 if (aclflag & CIFS_ACL_DACL) ce9f9c0511bbb9 fs/smb/client/cifsacl.c Pali Rohár 2024-10-14 1509 access_flags |= WRITE_DAC;
Quoted 1 line
What if the permisions are 000?
Then it means "no permission". And SMB server refuses opening file/dir with "no permission". And in case the buggy server opens it, then kernel would ask to do "no operation" as no update flag would be set.
But in any case, calling this ->set_acl() callback with zero or invalid aclflag is an error, so the callback would return error from server.
Now I check that no kernel code is calling ->set_acl() with zero / invalid flags.
So basically, it is just a compiler false-positive warning, not a real error in a code. But of course I will include the fixup from the list in next version.
Anyway, same logic is in set_smb2_acl implementation of ->set_acl() callback. So I think it is safe.
Quoted 17 lines
a5ff376966c079 fs/cifs/cifsacl.c Shirish Pargaonkar 2011-10-13 1510 de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1511 oparms = (struct cifs_open_parms) { de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1512 .tcon = tcon, de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1513 .cifs_sb = cifs_sb, de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 @1514 .desired_access = access_flags, ^^^^^^^^^^^^warning
de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1515 .create_options = cifs_create_options(cifs_sb, 0), de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1516 .disposition = FILE_OPEN, de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1517 .path = path, de036dcaca65cf fs/cifs/cifsacl.c Volker Lendecke 2023-01-11 1518 .fid = &fid,Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki