Re: [EXTERNAL] [samba-ksmbd:for-next 4/7] fs/smb/client/ioctl.c:324:17: warning: variable 'caps' set but not used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix attached:

Fix trivial unused variable warning (when SMB1 support disabled)

"ioctl.c:324:17: warning: variable 'caps' set but not used
[-Wunused-but-set-variable]"

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202305250056.oZhsJmdD-lkp@xxxxxxxxx/

> From: kernel test robot <lkp@xxxxxxxxx>
> Sent: Wednesday, May 24, 2023 7:01:39 AM
> To: Steven French <Steven.French@xxxxxxxxxxxxx>
> Cc: oe-kbuild-all@xxxxxxxxxxxxxxx <oe-kbuild-all@xxxxxxxxxxxxxxx>
> Subject: [EXTERNAL] [samba-ksmbd:for-next 4/7] fs/smb/client/ioctl.c:324:17: warning: variable 'caps' set but not used
>
> Hi Steve,
>
> First bad commit (maybe != root cause):
>
> tree:   git://git.samba.org/ksmbd.git for-next
> head:   d58a8a27a7cac75e82383c2a25704bd15b0045d5
> commit: e3adc6b1f0d12b80a7a81fd4f345890a4fb483d6 [4/7] smb: move client and server files to common directory fs/smb
> config: i386-randconfig-i003-20230524
> compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
> reproduce (this is a W=1 build):
>         git remote add samba-ksmbd git://git.samba.org/ksmbd.git
>         git fetch --no-tags samba-ksmbd for-next
>         git checkout e3adc6b1f0d12b80a7a81fd4f345890a4fb483d6
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         make W=1 O=build_dir ARCH=i386 olddefconfig
>         make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/smb/client/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Foe-kbuild-all%2F202305250056.oZhsJmdD-lkp%40intel.com%2F&data=05%7C01%7CSteven.French%40microsoft.com%7Caf0e1ee950724b4eb2ce08db5c78aca3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638205445595592058%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=moaptwMZutTbXzs%2F65jeBFL8bJmVzWsjoLBeuDAQaMc%3D&reserved=0
>
> All warnings (new ones prefixed by >>):
>
>    fs/smb/client/ioctl.c: In function 'cifs_ioctl':
> >> fs/smb/client/ioctl.c:324:17: warning: variable 'caps' set but not used [-Wunused-but-set-variable]
>      324 |         __u64   caps;
>          |                 ^~~~
>
>
> vim +/caps +324 fs/smb/client/ioctl.c
>
> 7ba3d1cdb7988c fs/cifs/ioctl.c Steve French    2021-05-02  312
> f9ddcca4cf7d95 fs/cifs/ioctl.c Steve French    2008-05-15  313  long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
> ^1da177e4c3f41 fs/cifs/ioctl.c Linus Torvalds  2005-04-16  314  {
> 496ad9aa8ef448 fs/cifs/ioctl.c Al Viro         2013-01-23  315   struct inode *inode = file_inode(filep);
> 7e7db86c7e1088 fs/cifs/ioctl.c Steve French    2019-09-19  316   struct smb3_key_debug_info pkey_inf;
> ^1da177e4c3f41 fs/cifs/ioctl.c Linus Torvalds  2005-04-16  317   int rc = -ENOTTY; /* strange error - but the precedent */
> 6d5786a34d98bf fs/cifs/ioctl.c Pavel Shilovsky 2012-06-20  318   unsigned int xid;
> ba00ba64cf0895 fs/cifs/ioctl.c Jeff Layton     2010-09-20  319   struct cifsFileInfo *pSMBFile = filep->private_data;
> 96daf2b09178d8 fs/cifs/ioctl.c Steve French    2011-05-27  320   struct cifs_tcon *tcon;
> a77592a70081ed fs/cifs/ioctl.c Ronnie Sahlberg 2020-07-09  321   struct tcon_link *tlink;
> d26c2ddd335696 fs/cifs/ioctl.c Steve French    2020-02-06  322   struct cifs_sb_info *cifs_sb;
> f654bac2227adc fs/cifs/ioctl.c Steve French    2005-04-28  323   __u64   ExtAttrBits = 0;
> 618763958b2291 fs/cifs/ioctl.c Jeff Layton     2010-11-08 @324   __u64   caps;
>
> :::::: The code at line 324 was first introduced by commit
> :::::: 618763958b2291a09057dbfa553da6ded93dcfad cifs: make cifs_ioctl handle NULL filp->private_data correctly
>
> :::::: TO: Jeff Layton <jlayton@xxxxxxxxxx>
> :::::: CC: Steve French <sfrench@xxxxxxxxxx>
>
> --
> 0-DAY CI Kernel Test Service
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fintel%2Flkp-tests%2Fwiki&data=05%7C01%7CSteven.French%40microsoft.com%7Caf0e1ee950724b4eb2ce08db5c78aca3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638205445595592058%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=4S7ypbEmVEH0ItLaFq6203nT%2FVUHq%2FI%2B0DPIw8MLllw%3D&reserved=0



-- 
Thanks,

Steve
From fdd7d1fff4e3b97c4706f4c0e000a38b134b7ae5 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Sat, 27 May 2023 03:33:23 -0500
Subject: [PATCH] cifs: address unused variable warning

Fix trivial unused variable warning (when SMB1 support disabled)

"ioctl.c:324:17: warning: variable 'caps' set but not used [-Wunused-but-set-variable]"

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202305250056.oZhsJmdD-lkp@xxxxxxxxx/
Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
---
 fs/smb/client/ioctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/smb/client/ioctl.c b/fs/smb/client/ioctl.c
index cb3be58cd55e..fff092bbc7a3 100644
--- a/fs/smb/client/ioctl.c
+++ b/fs/smb/client/ioctl.c
@@ -321,7 +321,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 	struct tcon_link *tlink;
 	struct cifs_sb_info *cifs_sb;
 	__u64	ExtAttrBits = 0;
+#ifdef CONFIG_CIFS_POSIX
+#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
 	__u64   caps;
+#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
+#endif /* CONFIG_CIFS_POSIX */
 
 	xid = get_xid();
 
@@ -331,9 +335,9 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 			if (pSMBFile == NULL)
 				break;
 			tcon = tlink_tcon(pSMBFile->tlink);
-			caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
 #ifdef CONFIG_CIFS_POSIX
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+			caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
 			if (CIFS_UNIX_EXTATTR_CAP & caps) {
 				__u64	ExtAttrMask = 0;
 				rc = CIFSGetExtAttr(xid, tcon,
-- 
2.34.1


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux