linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFSD: hide unused svcxdr_dupstr()
@ 2018-01-19 14:54 Arnd Bergmann
  2018-01-19 16:15 ` Chuck Lever
  2018-01-19 21:58 ` Rasmus Villemoes
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2018-01-19 14:54 UTC (permalink / raw)
  To: J. Bruce Fields, Jeff Layton
  Cc: Arnd Bergmann, Chuck Lever, Trond Myklebust, Kinglong Mee,
	linux-nfs, linux-kernel

There is now only one caller left for svcxdr_dupstr() and this is inside
of an #ifdef, so we can get a warning when the option is disabled:

fs/nfsd/nfs4xdr.c:241:1: error: 'svcxdr_dupstr' defined but not used [-Werror=unused-function]

This adds another #ifdef around the definition.

Fixes: e40d99e6183e ("NFSD: Clean up symlink argument XDR decoders")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/nfsd/nfs4xdr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index f51c9cccaf78..374a62af6034 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -237,6 +237,7 @@ svcxdr_tmpalloc(struct nfsd4_compoundargs *argp, u32 len)
  * Note null-terminating in place usually isn't safe since the
  * buffer might end on a page boundary.
  */
+#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
 static char *
 svcxdr_dupstr(struct nfsd4_compoundargs *argp, void *buf, u32 len)
 {
@@ -248,6 +249,7 @@ svcxdr_dupstr(struct nfsd4_compoundargs *argp, void *buf, u32 len)
 	p[len] = '\0';
 	return p;
 }
+#endif
 
 /**
  * savemem - duplicate a chunk of memory for later processing
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFSD: hide unused svcxdr_dupstr()
  2018-01-19 14:54 [PATCH] NFSD: hide unused svcxdr_dupstr() Arnd Bergmann
@ 2018-01-19 16:15 ` Chuck Lever
  2018-01-19 16:27   ` Bruce Fields
  2018-01-19 21:58 ` Rasmus Villemoes
  1 sibling, 1 reply; 5+ messages in thread
From: Chuck Lever @ 2018-01-19 16:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bruce Fields, Jeff Layton, Trond Myklebust, Kinglong Mee,
	Linux NFS Mailing List, linux-kernel



> On Jan 19, 2018, at 9:54 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> There is now only one caller left for svcxdr_dupstr() and this is inside
> of an #ifdef, so we can get a warning when the option is disabled:
> 
> fs/nfsd/nfs4xdr.c:241:1: error: 'svcxdr_dupstr' defined but not used [-Werror=unused-function]
> 
> This adds another #ifdef around the definition.
> 
> Fixes: e40d99e6183e ("NFSD: Clean up symlink argument XDR decoders")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Seems OK to me, and sorry for the noise.

Reviewed-by: Chuck Lever <chuck.lever@oracle.com>


> ---
> fs/nfsd/nfs4xdr.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index f51c9cccaf78..374a62af6034 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -237,6 +237,7 @@ svcxdr_tmpalloc(struct nfsd4_compoundargs *argp, u32 len)
>  * Note null-terminating in place usually isn't safe since the
>  * buffer might end on a page boundary.
>  */
> +#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
> static char *
> svcxdr_dupstr(struct nfsd4_compoundargs *argp, void *buf, u32 len)
> {
> @@ -248,6 +249,7 @@ svcxdr_dupstr(struct nfsd4_compoundargs *argp, void *buf, u32 len)
> 	p[len] = '\0';
> 	return p;
> }
> +#endif
> 
> /**
>  * savemem - duplicate a chunk of memory for later processing
> -- 
> 2.9.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFSD: hide unused svcxdr_dupstr()
  2018-01-19 16:15 ` Chuck Lever
@ 2018-01-19 16:27   ` Bruce Fields
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Fields @ 2018-01-19 16:27 UTC (permalink / raw)
  To: Chuck Lever
  Cc: Arnd Bergmann, Jeff Layton, Trond Myklebust, Kinglong Mee,
	Linux NFS Mailing List, linux-kernel

On Fri, Jan 19, 2018 at 11:15:33AM -0500, Chuck Lever wrote:
> 
> 
> > On Jan 19, 2018, at 9:54 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> > 
> > There is now only one caller left for svcxdr_dupstr() and this is inside
> > of an #ifdef, so we can get a warning when the option is disabled:
> > 
> > fs/nfsd/nfs4xdr.c:241:1: error: 'svcxdr_dupstr' defined but not used [-Werror=unused-function]
> > 
> > This adds another #ifdef around the definition.
> > 
> > Fixes: e40d99e6183e ("NFSD: Clean up symlink argument XDR decoders")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Seems OK to me, and sorry for the noise.
> 
> Reviewed-by: Chuck Lever <chuck.lever@oracle.com>

Thanks!

--b.

> 
> 
> > ---
> > fs/nfsd/nfs4xdr.c | 2 ++
> > 1 file changed, 2 insertions(+)
> > 
> > diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> > index f51c9cccaf78..374a62af6034 100644
> > --- a/fs/nfsd/nfs4xdr.c
> > +++ b/fs/nfsd/nfs4xdr.c
> > @@ -237,6 +237,7 @@ svcxdr_tmpalloc(struct nfsd4_compoundargs *argp, u32 len)
> >  * Note null-terminating in place usually isn't safe since the
> >  * buffer might end on a page boundary.
> >  */
> > +#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
> > static char *
> > svcxdr_dupstr(struct nfsd4_compoundargs *argp, void *buf, u32 len)
> > {
> > @@ -248,6 +249,7 @@ svcxdr_dupstr(struct nfsd4_compoundargs *argp, void *buf, u32 len)
> > 	p[len] = '\0';
> > 	return p;
> > }
> > +#endif
> > 
> > /**
> >  * savemem - duplicate a chunk of memory for later processing
> > -- 
> > 2.9.0
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> --
> Chuck Lever
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFSD: hide unused svcxdr_dupstr()
  2018-01-19 14:54 [PATCH] NFSD: hide unused svcxdr_dupstr() Arnd Bergmann
  2018-01-19 16:15 ` Chuck Lever
@ 2018-01-19 21:58 ` Rasmus Villemoes
  2018-01-22 17:26   ` J. Bruce Fields
  1 sibling, 1 reply; 5+ messages in thread
From: Rasmus Villemoes @ 2018-01-19 21:58 UTC (permalink / raw)
  To: Arnd Bergmann, J. Bruce Fields, Jeff Layton
  Cc: Chuck Lever, Trond Myklebust, Kinglong Mee, linux-nfs, linux-kernel

On 2018-01-19 15:54, Arnd Bergmann wrote:
> There is now only one caller left for svcxdr_dupstr() and this is inside
> of an #ifdef, so we can get a warning when the option is disabled:
> 
> fs/nfsd/nfs4xdr.c:241:1: error: 'svcxdr_dupstr' defined but not used [-Werror=unused-function]
> 
> This adds another #ifdef around the definition.

Why not instead do

-#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
-       if (bmval[2] & FATTR4_WORD2_SECURITY_LABEL) {
+       if (IS_ENABLED(CONFIG_NFSD_V4_SECURITY_LABEL) && bmval[2] &
FATTR4_WORD2_SECURITY_LABEL)

(sorry for whitespace damage, not a real patch).

Rasmus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFSD: hide unused svcxdr_dupstr()
  2018-01-19 21:58 ` Rasmus Villemoes
@ 2018-01-22 17:26   ` J. Bruce Fields
  0 siblings, 0 replies; 5+ messages in thread
From: J. Bruce Fields @ 2018-01-22 17:26 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Arnd Bergmann, Jeff Layton, Chuck Lever, Trond Myklebust,
	Kinglong Mee, linux-nfs, linux-kernel

On Fri, Jan 19, 2018 at 10:58:27PM +0100, Rasmus Villemoes wrote:
> On 2018-01-19 15:54, Arnd Bergmann wrote:
> > There is now only one caller left for svcxdr_dupstr() and this is inside
> > of an #ifdef, so we can get a warning when the option is disabled:
> > 
> > fs/nfsd/nfs4xdr.c:241:1: error: 'svcxdr_dupstr' defined but not used [-Werror=unused-function]
> > 
> > This adds another #ifdef around the definition.
> 
> Why not instead do
> 
> -#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
> -       if (bmval[2] & FATTR4_WORD2_SECURITY_LABEL) {
> +       if (IS_ENABLED(CONFIG_NFSD_V4_SECURITY_LABEL) && bmval[2] &
> FATTR4_WORD2_SECURITY_LABEL)
> 
> (sorry for whitespace damage, not a real patch).

That'd be OK with me too.

--b.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-22 17:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 14:54 [PATCH] NFSD: hide unused svcxdr_dupstr() Arnd Bergmann
2018-01-19 16:15 ` Chuck Lever
2018-01-19 16:27   ` Bruce Fields
2018-01-19 21:58 ` Rasmus Villemoes
2018-01-22 17:26   ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).