Skip to contentSkip to conversation

sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op

PATCH In review Andy Shevchenko 3 participants 10 messages Feb 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op

Clang compiler is not happy about set but unused variables:

.../flexfilelayout/flexfilelayoutdev.c:56:9: error: variable 'ret' set but not used [-Werror,-Wunused-but-set-variable] .../flexfilelayout/flexfilelayout.c:1505:6: error: variable 'err' set but not used [-Werror,-Wunused-but-set-variable] .../nfs4proc.c:9244:12: error: variable 'ptr' set but not used [-Werror,-Wunused-but-set-variable]

Fix these by forwarding parameters of dprintk() to no_printk(). The positive side-effect is a format-string checker enabled even for the cases when dprintk() is no-op.

Fixes d67ae825a59d ("pnfs/flexfiles: Add the FlexFile Layout Driver")
Fixes fc931582c260 ("nfs41: create_session operation")
---
 fs/lockd/svclock.c           | 5 +++++
 include/linux/sunrpc/debug.h | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
fs/lockd/svclock.c +5 -0
index 712df1e025d8..dcd3e0b4d997 100644
@@ -80,6 +80,11 @@ static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
 
 	return buf;
 }
+#else
+static inline const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
+{
+	return "???";
+}
 #endif
 
 /*
include/linux/sunrpc/debug.h +6 -2
index 891f6173c951..070b2d20191b 100644
@@ -40,6 +40,8 @@ extern unsigned int		nlm_debug;
 do {									\
 	ifdebug(fac)							\
 		__sunrpc_printk(fmt, ##__VA_ARGS__);			\
+	else								\
+		no_printk(fmt, ##__VA_ARGS__);				\
 } while (0)
 
 # define dfprintk_rcu(fac, fmt, ...)					\
@@ -48,14 +50,16 @@ do {									\
 		rcu_read_lock();					\
 		__sunrpc_printk(fmt, ##__VA_ARGS__);			\
 		rcu_read_unlock();					\
+	} else {							\
+		no_printk(fmt, ##__VA_ARGS__);				\
 	}								\
 } while (0)
 
 # define RPC_IFDEBUG(x)		x
 #else
 # define ifdebug(fac)		if (0)
-# define dfprintk(fac, fmt, ...)	do {} while (0)
-# define dfprintk_rcu(fac, fmt, ...)	do {} while (0)
+# define dfprintk(fac, fmt, ...)	no_printk(fmt, ##__VA_ARGS__)
+# define dfprintk_rcu(fac, fmt, ...)	no_printk(fmt, ##__VA_ARGS__)
 # define RPC_IFDEBUG(x)
 #endif
 
Signature · 1 line
2.50.1
#1 lore raw
Quoted 9 lines · Andy Shevchenko

Clang compiler is not happy about set but unused variables:

.../flexfilelayout/flexfilelayoutdev.c:56:9: error: variable 'ret' set but not used [-Werror,-Wunused-but-set-variable] .../flexfilelayout/flexfilelayout.c:1505:6: error: variable 'err' set but not used [-Werror,-Wunused-but-set-variable] .../nfs4proc.c:9244:12: error: variable 'ptr' set but not used [-Werror,-Wunused-but-set-variable]

Fix these by forwarding parameters of dprintk() to no_printk(). The positive side-effect is a format-string checker enabled even for the cases when dprintk() is no-op.

Note, the alternative fix is to add __maybe_unused all over the place. With pros and cons I consider my approach better.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
In reply to Andy Shevchenko
kernel test robot noticed the following build errors:

Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on trondmy-nfs/linux-next]
[also build test ERROR on linus/master v6.19-rc8 next-20260203] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/sunrpc-Fix-compilation-error-make-W-1-when-dprintk-is-no-op/20260204-091033
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/20260204010415.2149607-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
config: m68k-defconfig (https://download.01.org/0day-ci/archive/20260204/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260204/[email protected]/reproduce)

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]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from include/asm-generic/bug.h:31,

                    from arch/m68k/include/asm/bug.h:32,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:13,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/m68k/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:79,
                    from arch/m68k/include/asm/processor.h:11,
                    from include/linux/sched.h:13,
                    from include/linux/sunrpc/svcauth_gss.h:12,
                    from fs/nfsd/nfsfh.c:13:
   fs/nfsd/nfsfh.c: In function 'nfsd_setuser_and_check_port':
>> fs/nfsd/nfsfh.c:110:47: error: 'buf' undeclared (first use in this function); did you mean 'btf'?
     110 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                               ^~~
   include/linux/printk.h:135:32: note: in definition of macro 'no_printk'
     135 |                 _printk(fmt, ##__VA_ARGS__);            \
         |                                ^~~~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfsd/nfsfh.c:109:17: note: in expansion of macro 'dprintk'
     109 |                 dprintk("nfsd: request from insecure port %s!\n",
         |                 ^~~~~~~
   fs/nfsd/nfsfh.c:110:47: note: each undeclared identifier is reported only once for each function it appears in
     110 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                               ^~~
   include/linux/printk.h:135:32: note: in definition of macro 'no_printk'
     135 |                 _printk(fmt, ##__VA_ARGS__);            \
         |                                ^~~~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfsd/nfsfh.c:109:17: note: in expansion of macro 'dprintk'
     109 |                 dprintk("nfsd: request from insecure port %s!\n",
         |                 ^~~~~~~

vim +110 fs/nfsd/nfsfh.c

9d7ed1355db5b00 J. Bruce Fields 2018-03-08  101  
6fa02839bf9412e J. Bruce Fields 2007-11-12  102  static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
b0d87dbd8bd311d NeilBrown       2024-09-05  103  					  struct svc_cred *cred,
6fa02839bf9412e J. Bruce Fields 2007-11-12  104  					  struct svc_export *exp)
6fa02839bf9412e J. Bruce Fields 2007-11-12  105  {
6fa02839bf9412e J. Bruce Fields 2007-11-12  106  	/* Check if the request originated from a secure port. */
b0d87dbd8bd311d NeilBrown       2024-09-05  107  	if (rqstp && !nfsd_originating_port_ok(rqstp, cred, exp)) {
5216a8e70e25b01 Pavel Emelyanov 2008-02-21  108  		RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
a48fd0f9f77b6e1 Kinglong Mee    2014-05-29  109  		dprintk("nfsd: request from insecure port %s!\n",
6fa02839bf9412e J. Bruce Fields 2007-11-12 @110  		        svc_print_addr(rqstp, buf, sizeof(buf)));
6fa02839bf9412e J. Bruce Fields 2007-11-12  111  		return nfserr_perm;
6fa02839bf9412e J. Bruce Fields 2007-11-12  112  	}
6fa02839bf9412e J. Bruce Fields 2007-11-12  113  
6fa02839bf9412e J. Bruce Fields 2007-11-12  114  	/* Set user creds for this exportpoint */
b0d87dbd8bd311d NeilBrown       2024-09-05  115  	return nfserrno(nfsd_setuser(cred, exp));
6fa02839bf9412e J. Bruce Fields 2007-11-12  116  }
6fa02839bf9412e J. Bruce Fields 2007-11-12  117  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#6 lore raw
In reply to Andy Shevchenko
kernel test robot noticed the following build errors:

Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on trondmy-nfs/linux-next]
[also build test ERROR on linus/master v6.19-rc8 next-20260203] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/sunrpc-Fix-compilation-error-make-W-1-when-dprintk-is-no-op/20260204-091033
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/20260204010415.2149607-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260204/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260204/[email protected]/reproduce)

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]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> fs/nfsd/nfsfh.c:110:45: error: use of undeclared identifier 'buf'
     110 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                                           ^
   fs/nfsd/nfsfh.c:110:33: error: use of undeclared identifier 'buf'
     110 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                               ^

2 errors generated.

vim +/buf +110 fs/nfsd/nfsfh.c

9d7ed1355db5b0 J. Bruce Fields 2018-03-08  101  
6fa02839bf9412 J. Bruce Fields 2007-11-12  102  static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
b0d87dbd8bd311 NeilBrown       2024-09-05  103  					  struct svc_cred *cred,
6fa02839bf9412 J. Bruce Fields 2007-11-12  104  					  struct svc_export *exp)
6fa02839bf9412 J. Bruce Fields 2007-11-12  105  {
6fa02839bf9412 J. Bruce Fields 2007-11-12  106  	/* Check if the request originated from a secure port. */
b0d87dbd8bd311 NeilBrown       2024-09-05  107  	if (rqstp && !nfsd_originating_port_ok(rqstp, cred, exp)) {
5216a8e70e25b0 Pavel Emelyanov 2008-02-21  108  		RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
a48fd0f9f77b6e Kinglong Mee    2014-05-29  109  		dprintk("nfsd: request from insecure port %s!\n",
6fa02839bf9412 J. Bruce Fields 2007-11-12 @110  		        svc_print_addr(rqstp, buf, sizeof(buf)));
6fa02839bf9412 J. Bruce Fields 2007-11-12  111  		return nfserr_perm;
6fa02839bf9412 J. Bruce Fields 2007-11-12  112  	}
6fa02839bf9412 J. Bruce Fields 2007-11-12  113  
6fa02839bf9412 J. Bruce Fields 2007-11-12  114  	/* Set user creds for this exportpoint */
b0d87dbd8bd311 NeilBrown       2024-09-05  115  	return nfserrno(nfsd_setuser(cred, exp));
6fa02839bf9412 J. Bruce Fields 2007-11-12  116  }
6fa02839bf9412 J. Bruce Fields 2007-11-12  117  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#7 lore raw
In reply to Andy Shevchenko
kernel test robot noticed the following build errors:

Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on trondmy-nfs/linux-next]
[also build test ERROR on linus/master v6.19-rc8 next-20260203] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/sunrpc-Fix-compilation-error-make-W-1-when-dprintk-is-no-op/20260204-091033
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/20260204010415.2149607-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260204/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260204/[email protected]/reproduce)

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]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> fs/nfsd/nfsfh.c:110:45: error: use of undeclared identifier 'buf'
     110 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                                           ^
   fs/nfsd/nfsfh.c:110:33: error: use of undeclared identifier 'buf'
     110 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                               ^

2 errors generated.

vim +/buf +110 fs/nfsd/nfsfh.c

9d7ed1355db5b0 J. Bruce Fields 2018-03-08  101  
6fa02839bf9412 J. Bruce Fields 2007-11-12  102  static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
b0d87dbd8bd311 NeilBrown       2024-09-05  103  					  struct svc_cred *cred,
6fa02839bf9412 J. Bruce Fields 2007-11-12  104  					  struct svc_export *exp)
6fa02839bf9412 J. Bruce Fields 2007-11-12  105  {
6fa02839bf9412 J. Bruce Fields 2007-11-12  106  	/* Check if the request originated from a secure port. */
b0d87dbd8bd311 NeilBrown       2024-09-05  107  	if (rqstp && !nfsd_originating_port_ok(rqstp, cred, exp)) {
5216a8e70e25b0 Pavel Emelyanov 2008-02-21  108  		RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
a48fd0f9f77b6e Kinglong Mee    2014-05-29  109  		dprintk("nfsd: request from insecure port %s!\n",
6fa02839bf9412 J. Bruce Fields 2007-11-12 @110  		        svc_print_addr(rqstp, buf, sizeof(buf)));
6fa02839bf9412 J. Bruce Fields 2007-11-12  111  		return nfserr_perm;
6fa02839bf9412 J. Bruce Fields 2007-11-12  112  	}
6fa02839bf9412 J. Bruce Fields 2007-11-12  113  
6fa02839bf9412 J. Bruce Fields 2007-11-12  114  	/* Set user creds for this exportpoint */
b0d87dbd8bd311 NeilBrown       2024-09-05  115  	return nfserrno(nfsd_setuser(cred, exp));
6fa02839bf9412 J. Bruce Fields 2007-11-12  116  }
6fa02839bf9412 J. Bruce Fields 2007-11-12  117  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#8 lore raw
In reply to Andy Shevchenko
kernel test robot noticed the following build errors:

Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on trondmy-nfs/linux-next]
[also build test ERROR on linus/master v6.19-rc8 next-20260203] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/sunrpc-Fix-compilation-error-make-W-1-when-dprintk-is-no-op/20260204-091033
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/20260204010415.2149607-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260204/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260204/[email protected]/reproduce)

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]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from include/asm-generic/bug.h:31,

                    from arch/x86/include/asm/bug.h:193,
                    from arch/x86/include/asm/alternative.h:9,
                    from arch/x86/include/asm/segment.h:6,
                    from arch/x86/include/asm/ptrace.h:5,
                    from arch/x86/include/asm/math_emu.h:5,
                    from arch/x86/include/asm/processor.h:13,
                    from include/linux/sched.h:13,
                    from include/linux/sunrpc/svcauth_gss.h:12,
                    from fs/nfsd/nfsfh.c:13:
   fs/nfsd/nfsfh.c: In function 'nfsd_setuser_and_check_port':
>> fs/nfsd/nfsfh.c:110:47: error: 'buf' undeclared (first use in this function); did you mean 'btf'?
     110 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                               ^~~
   include/linux/printk.h:135:32: note: in definition of macro 'no_printk'
     135 |                 _printk(fmt, ##__VA_ARGS__);            \
         |                                ^~~~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfsd/nfsfh.c:109:17: note: in expansion of macro 'dprintk'
     109 |                 dprintk("nfsd: request from insecure port %s!\n",
         |                 ^~~~~~~
   fs/nfsd/nfsfh.c:110:47: note: each undeclared identifier is reported only once for each function it appears in
     110 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                               ^~~
   include/linux/printk.h:135:32: note: in definition of macro 'no_printk'
     135 |                 _printk(fmt, ##__VA_ARGS__);            \
         |                                ^~~~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfsd/nfsfh.c:109:17: note: in expansion of macro 'dprintk'
     109 |                 dprintk("nfsd: request from insecure port %s!\n",
         |                 ^~~~~~~

vim +110 fs/nfsd/nfsfh.c

9d7ed1355db5b0 J. Bruce Fields 2018-03-08  101  
6fa02839bf9412 J. Bruce Fields 2007-11-12  102  static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
b0d87dbd8bd311 NeilBrown       2024-09-05  103  					  struct svc_cred *cred,
6fa02839bf9412 J. Bruce Fields 2007-11-12  104  					  struct svc_export *exp)
6fa02839bf9412 J. Bruce Fields 2007-11-12  105  {
6fa02839bf9412 J. Bruce Fields 2007-11-12  106  	/* Check if the request originated from a secure port. */
b0d87dbd8bd311 NeilBrown       2024-09-05  107  	if (rqstp && !nfsd_originating_port_ok(rqstp, cred, exp)) {
5216a8e70e25b0 Pavel Emelyanov 2008-02-21  108  		RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
a48fd0f9f77b6e Kinglong Mee    2014-05-29  109  		dprintk("nfsd: request from insecure port %s!\n",
6fa02839bf9412 J. Bruce Fields 2007-11-12 @110  		        svc_print_addr(rqstp, buf, sizeof(buf)));
6fa02839bf9412 J. Bruce Fields 2007-11-12  111  		return nfserr_perm;
6fa02839bf9412 J. Bruce Fields 2007-11-12  112  	}
6fa02839bf9412 J. Bruce Fields 2007-11-12  113  
6fa02839bf9412 J. Bruce Fields 2007-11-12  114  	/* Set user creds for this exportpoint */
b0d87dbd8bd311 NeilBrown       2024-09-05  115  	return nfserrno(nfsd_setuser(cred, exp));
6fa02839bf9412 J. Bruce Fields 2007-11-12  116  }
6fa02839bf9412 J. Bruce Fields 2007-11-12  117  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#2 lore raw
In reply to Andy Shevchenko

Hi Andy,

Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Andy Shevchenko

Clang compiler is not happy about set but unused variables:

.../flexfilelayout/flexfilelayoutdev.c:56:9: error: variable 'ret' set but not used [-Werror,-Wunused-but-set-variable] .../flexfilelayout/flexfilelayout.c:1505:6: error: variable 'err' set but not used [-Werror,-Wunused-but-set-variable] .../nfs4proc.c:9244:12: error: variable 'ptr' set but not used [-Werror,-Wunused-but-set-variable]

Quoted 6 lines
Quoted 3 lines

Fix these by forwarding parameters of dprintk() to no_printk(). The positive side-effect is a format-string checker enabled even for the cases when dprintk() is no-op.

Note, the alternative fix is to add __maybe_unused all over the place. With pros and cons I consider my approach better.

Definitely. I tried something similar a few years ago[1], but ran into build errors from the robots, and gave up due to lack of time.

So for the principle:

Ah, my local tree still has the following fix I never sent out, and still looks suboptimal:

fs/nfsd/nfsfh.c +0 -0
@@ -105,9 +105,11 @@ static __be32 nfsd_setuser_and_check_port(struct

svc_rqst *rqstp,

 {
        /* Check if the request originated from a secure port. */
        if (rqstp && !nfsd_originating_port_ok(rqstp, cred, exp)) {

- RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
+#ifdef CONFIG_SUNRPC_DEBUG
+ char buf[RPC_MAX_ADDRBUFLEN];
dprintk("nfsd: request from insecure port %s!\n",
svc_print_addr(rqstp, buf, sizeof(buf)));
+#endif

                return nfserr_perm;
        }

[1] https://lore.kernel.org/a93de2e8afa826745746b00fc5f64e513df5d52f.1697104757.git.geert+renesas@glider.be

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#3 lore raw
Quoted 3 lines · Geert Uytterhoeven
Quoted 1 line · Andy Shevchenko

On Wed, Feb 04, 2026 at 02:04:15AM +0100, Andy Shevchenko wrote:

...

Quoted 2 lines

Definitely. I tried something similar a few years ago[1], but ran into build errors from the robots, and gave up due to lack of time.

For the matter of fact, I also get into errors from LKP (I compiled only part of this, need to enable more to cover these cases).

Quoted 2 lines

So for the principle:

Thanks, I will do more tests and fixes and add your Ack.

Quoted 2 lines

Ah, my local tree still has the following fix I never sent out, and still looks suboptimal:

Right, thanks for sharing, it's the same call robots are not okay with.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 1 line · Andy Shevchenko

On Wed, Feb 04, 2026 at 08:53:39AM +0100, Geert Uytterhoeven wrote:

...

Quoted 1 line

Thanks, I will do more tests and fixes and add your Ack.

v2 just has been sent. You Cc'ed only on patch 3, but it should be available in full here https://lore.kernel.org/r/[email protected]

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw
In reply to Andy Shevchenko
kernel test robot noticed the following build warnings:

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on trondmy-nfs/linux-next]
[also build test WARNING on linus/master v6.19-rc8 next-20260203] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/sunrpc-Fix-compilation-error-make-W-1-when-dprintk-is-no-op/20260204-091033
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/20260204010415.2149607-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
config: powerpc-randconfig-r131-20260204 (https://download.01.org/0day-ci/archive/20260204/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260204/[email protected]/reproduce)

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]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> fs/nfs/getroot.c:90:17: sparse: sparse: incompatible types in conditional expression (different base types):

fs/nfs/getroot.c:90:17: sparse: void
fs/nfs/getroot.c:90:17: sparse: int
fs/nfs/getroot.c:98:17: sparse: sparse: incompatible types in conditional expression (different base types):
fs/nfs/getroot.c:98:17: sparse: void
fs/nfs/getroot.c:98:17: sparse: int
fs/nfs/getroot.c:114:17: sparse: sparse: incompatible types in conditional expression (different base types):
fs/nfs/getroot.c:114:17: sparse: void
fs/nfs/getroot.c:114:17: sparse: int
--
fs/nfs/namespace.c:381:1: sparse: sparse: bad integer constant expression
fs/nfs/namespace.c:381:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/namespace.c:382:1: sparse: sparse: bad integer constant expression
fs/nfs/namespace.c:382:1: sparse: sparse: static assertion failed: "MODULE_INFO(parm, ...) contains embedded NUL byte"

>> fs/nfs/namespace.c:304:17: sparse: sparse: incompatible types in conditional expression (different base types):

fs/nfs/namespace.c:304:17: sparse: void
fs/nfs/namespace.c:304:17: sparse: int
--
fs/nfs/nfs4super.c:313:1: sparse: sparse: bad integer constant expression
fs/nfs/nfs4super.c:313:1: sparse: sparse: static assertion failed: "MODULE_INFO(description, ...) contains embedded NUL byte" fs/nfs/nfs4super.c:314:1: sparse: sparse: bad integer constant expression
fs/nfs/nfs4super.c:314:1: sparse: sparse: static assertion failed: "MODULE_INFO(file, ...) contains embedded NUL byte" fs/nfs/nfs4super.c:314:1: sparse: sparse: bad integer constant expression
fs/nfs/nfs4super.c:314:1: sparse: sparse: static assertion failed: "MODULE_INFO(license, ...) contains embedded NUL byte"

>> fs/nfs/nfs4super.c:232:17: sparse: sparse: incompatible types in conditional expression (different base types):

fs/nfs/nfs4super.c:232:17: sparse: void
fs/nfs/nfs4super.c:232:17: sparse: int
fs/nfs/nfs4super.c:255:17: sparse: sparse: incompatible types in conditional expression (different base types):
fs/nfs/nfs4super.c:255:17: sparse: void
fs/nfs/nfs4super.c:255:17: sparse: int
--
fs/nfs/super.c:1436:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1436:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1437:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1437:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1438:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1438:1: sparse: sparse: static assertion failed: "MODULE_INFO(parm, ...) contains embedded NUL byte" fs/nfs/super.c:1440:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1440:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1441:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1441:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1442:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1442:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1444:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1444:1: sparse: sparse: static assertion failed: "MODULE_INFO(parm, ...) contains embedded NUL byte" fs/nfs/super.c:1446:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1446:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1447:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1447:1: sparse: sparse: static assertion failed: "MODULE_INFO(parm, ...) contains embedded NUL byte" fs/nfs/super.c:1449:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1449:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1450:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1450:1: sparse: sparse: static assertion failed: "MODULE_INFO(parm, ...) contains embedded NUL byte" fs/nfs/super.c:1452:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1452:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1453:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1453:1: sparse: sparse: static assertion failed: "MODULE_INFO(parm, ...) contains embedded NUL byte" fs/nfs/super.c:1455:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1455:1: sparse: sparse: static assertion failed: "MODULE_INFO(parm, ...) contains embedded NUL byte" fs/nfs/super.c:1457:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1457:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1458:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1458:1: sparse: sparse: static assertion failed: "MODULE_INFO(parm, ...) contains embedded NUL byte" fs/nfs/super.c:1462:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1462:1: sparse: sparse: static assertion failed: "MODULE_INFO(parmtype, ...) contains embedded NUL byte" fs/nfs/super.c:1463:1: sparse: sparse: bad integer constant expression
fs/nfs/super.c:1463:1: sparse: sparse: static assertion failed: "MODULE_INFO(parm, ...) contains embedded NUL byte"

>> fs/nfs/super.c:1325:17: sparse: sparse: incompatible types in conditional expression (different base types):

fs/nfs/super.c:1325:17: sparse: void
fs/nfs/super.c:1325:17: sparse: int
fs/nfs/super.c:1351:17: sparse: sparse: incompatible types in conditional expression (different base types):
fs/nfs/super.c:1351:17: sparse: void
fs/nfs/super.c:1351:17: sparse: int
--
fs/nfs/fs_context.c:1773:1: sparse: sparse: bad integer constant expression fs/nfs/fs_context.c:1773:1: sparse: sparse: static assertion failed: "MODULE_INFO(alias, ...) contains embedded NUL byte" fs/nfs/fs_context.c:1785:1: sparse: sparse: bad integer constant expression fs/nfs/fs_context.c:1785:1: sparse: sparse: static assertion failed: "MODULE_INFO(alias, ...) contains embedded NUL byte" fs/nfs/fs_context.c:1786:1: sparse: sparse: bad integer constant expression fs/nfs/fs_context.c:1786:1: sparse: sparse: static assertion failed: "MODULE_INFO(alias, ...) contains embedded NUL byte"

>> fs/nfs/fs_context.c:1119:9: sparse: sparse: incompatible types in conditional expression (different base types):

fs/nfs/fs_context.c:1119:9: sparse: void
fs/nfs/fs_context.c:1119:9: sparse: int
fs/nfs/fs_context.c:1122:9: sparse: sparse: incompatible types in conditional expression (different base types):
fs/nfs/fs_context.c:1122:9: sparse: void
fs/nfs/fs_context.c:1122:9: sparse: int
fs/nfs/fs_context.c:1125:9: sparse: sparse: incompatible types in conditional expression (different base types):
fs/nfs/fs_context.c:1125:9: sparse: void
fs/nfs/fs_context.c:1125:9: sparse: int
fs/nfs/fs_context.c:1590:9: sparse: sparse: incompatible types in conditional expression (different base types):
fs/nfs/fs_context.c:1590:9: sparse: void
fs/nfs/fs_context.c:1590:9: sparse: int
fs/nfs/fs_context.c:1604:9: sparse: sparse: incompatible types in conditional expression (different base types):
fs/nfs/fs_context.c:1604:9: sparse: void
fs/nfs/fs_context.c:1604:9: sparse: int

vim +90 fs/nfs/getroot.c

b09b9417d074e0 Trond Myklebust 2007-10-25  63  
54ceac45159860 David Howells   2006-08-22  64  /*
6d26c5e4d83cd3 Li Lingfeng     2024-08-24  65   * get a root dentry from the root filehandle
54ceac45159860 David Howells   2006-08-22  66   */
62a55d088cd87d Scott Mayhew    2019-12-10  67  int nfs_get_root(struct super_block *s, struct fs_context *fc)
54ceac45159860 David Howells   2006-08-22  68  {
62a55d088cd87d Scott Mayhew    2019-12-10  69  	struct nfs_fs_context *ctx = nfs_fc2context(fc);
eae00c5d6e48cc Scott Mayhew    2021-06-22  70  	struct nfs_server *server = NFS_SB(s), *clone_server;
54ceac45159860 David Howells   2006-08-22  71  	struct nfs_fsinfo fsinfo;
62a55d088cd87d Scott Mayhew    2019-12-10  72  	struct dentry *root;
54ceac45159860 David Howells   2006-08-22  73  	struct inode *inode;
62a55d088cd87d Scott Mayhew    2019-12-10  74  	char *name;
62a55d088cd87d Scott Mayhew    2019-12-10  75  	int error = -ENOMEM;
779df6a5480f13 Scott Mayhew    2020-03-03  76  	unsigned long kflags = 0, kflags_out = 0;
54ceac45159860 David Howells   2006-08-22  77  
62a55d088cd87d Scott Mayhew    2019-12-10  78  	name = kstrdup(fc->source, GFP_KERNEL);
b1942c5f8cf3be Al Viro         2011-03-16  79  	if (!name)
62a55d088cd87d Scott Mayhew    2019-12-10  80  		goto out;
b1942c5f8cf3be Al Viro         2011-03-16  81  
54ceac45159860 David Howells   2006-08-22  82  	/* get the actual root for this mount */
d755ad8dc752d4 Anna Schumaker  2021-10-22  83  	fsinfo.fattr = nfs_alloc_fattr_with_label(server);
62a55d088cd87d Scott Mayhew    2019-12-10  84  	if (fsinfo.fattr == NULL)
62a55d088cd87d Scott Mayhew    2019-12-10  85  		goto out_name;
54ceac45159860 David Howells   2006-08-22  86  
62a55d088cd87d Scott Mayhew    2019-12-10  87  	error = server->nfs_client->rpc_ops->getroot(server, ctx->mntfh, &fsinfo);
54ceac45159860 David Howells   2006-08-22  88  	if (error < 0) {
54ceac45159860 David Howells   2006-08-22  89  		dprintk("nfs_get_root: getattr error = %d\n", -error);

ce8866f0913ff1 Scott Mayhew 2019-12-10 @90 nfs_errorf(fc, "NFS: Couldn't getattr on root");

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki