Skip to contentSkip to conversation

NFSD: hide unused svcxdr_dupstr()

PATCH Superseded Arnd Bergmann 4 participants 5 messages Jan 19, 2018 – Jan 22, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFSD: hide unused svcxdr_dupstr()

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")
---
 fs/nfsd/nfs4xdr.c | 2 ++
 1 file changed, 2 insertions(+)
fs/nfsd/nfs4xdr.c +2 -0
index f51c9cccaf78..374a62af6034 100644
@@ -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
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Arnd Bergmann

=20
There is now only one caller left for svcxdr_dupstr() and this is =

inside

Quoted 3 lines

of an #ifdef, so we can get a warning when the option is disabled:
=20
fs/nfsd/nfs4xdr.c:241:1: error: 'svcxdr_dupstr' defined but not used =

[-Werror=3Dunused-function]

Quoted 5 lines

=20
This adds another #ifdef around the definition.
=20

Fixes e40d99e6183e ("NFSD: Clean up symlink argument XDR decoders")

Seems OK to me, and sorry for the noise.

fs/nfsd/nfs4xdr.c svcxdr_tmpalloc(struct nfsd4_compoundargs *argp, =

Quoted 9 lines

---
fs/nfsd/nfs4xdr.c | 2 ++

1 file changed, 2 insertions(+)

=20

fs/nfsd/nfs4xdr.c +0 -0
index f51c9cccaf78..374a62af6034 100644
@@ -237,6 +237,7 @@ svcxdr_tmpalloc(struct nfsd4_compoundargs *argp, =

u32 len)

fs/nfsd/nfs4xdr.c svcxdr_dupstr(struct nfsd4_compoundargs *argp, =

Quoted 8 lines
fs/nfsd/nfs4xdr.c +1 -0
 * 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) {

fs/nfsd/nfs4xdr.c +0 -0
@@ -248,6 +249,7 @@ svcxdr_dupstr(struct nfsd4_compoundargs *argp, =

void *buf, u32 len)

Quoted 4 lines
fs/nfsd/nfs4xdr.c +1 -0
 	p[len] =3D '\0';
 	return p;
 }
+#endif
Quoted 8 lines

=20
/**
* savemem - duplicate a chunk of memory for later processing
--=20
2.9.0
=20
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =

in

Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Chuck Lever

#2 lore raw
Quoted 9 lines · Chuck Lever
Quoted 9 lines · Arnd Bergmann

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]

Quoted 8 lines
Quoted 4 lines

This adds another #ifdef around the definition.

Fixes e40d99e6183e ("NFSD: Clean up symlink argument XDR decoders")

Seems OK to me, and sorry for the noise.

Thanks!

--b.

Quoted 38 lines
Quoted 33 lines

---
fs/nfsd/nfs4xdr.c | 2 ++

1 file changed, 2 insertions(+)
fs/nfsd/nfs4xdr.c +1 -0
index f51c9cccaf78..374a62af6034 100644
@@ -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) {

fs/nfsd/nfs4xdr.c +1 -0
@@ -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
Signature · 6 lines
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever

#3 lore raw
In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

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

#4 lore raw
Quoted 15 lines · Rasmus Villemoes
Quoted 6 lines · Arnd Bergmann

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

(quoted diff) +1 -2
-#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)

Quoted 1 line

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

That'd be OK with me too.

--b.