Skip to content

Commit ef81882

Browse files
committed
patches: mainline: Add nfsd strlen conflict patch
This is needed to fix ARCH=hexagon allmodconfig. Signed-off-by: Nathan Chancellor <[email protected]>
1 parent 6ae0118 commit ef81882

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
From c710de671789388b3af1046c7091685594ec44d9 Mon Sep 17 00:00:00 2001
2+
From: Nathan Chancellor <[email protected]>
3+
Date: Tue, 30 Sep 2025 11:31:34 -0700
4+
Subject: nfsd: Avoid strlen conflict in nfsd4_encode_components_esc()
5+
6+
There is an error building nfs4xdr.c with CONFIG_SUNRPC_DEBUG_TRACE=y
7+
and CONFIG_FORTIFY_SOURCE=n due to the local variable strlen conflicting
8+
with the function strlen():
9+
10+
In file included from include/linux/cpumask.h:11,
11+
from arch/x86/include/asm/paravirt.h:21,
12+
from arch/x86/include/asm/irqflags.h:102,
13+
from include/linux/irqflags.h:18,
14+
from include/linux/spinlock.h:59,
15+
from include/linux/mmzone.h:8,
16+
from include/linux/gfp.h:7,
17+
from include/linux/slab.h:16,
18+
from fs/nfsd/nfs4xdr.c:37:
19+
fs/nfsd/nfs4xdr.c: In function 'nfsd4_encode_components_esc':
20+
include/linux/kernel.h:321:46: error: called object 'strlen' is not a function or function pointer
21+
321 | __trace_puts(_THIS_IP_, str, strlen(str)); \
22+
| ^~~~~~
23+
include/linux/kernel.h:265:17: note: in expansion of macro 'trace_puts'
24+
265 | trace_puts(fmt); \
25+
| ^~~~~~~~~~
26+
include/linux/sunrpc/debug.h:34:41: note: in expansion of macro 'trace_printk'
27+
34 | # define __sunrpc_printk(fmt, ...) trace_printk(fmt, ##__VA_ARGS__)
28+
| ^~~~~~~~~~~~
29+
include/linux/sunrpc/debug.h:42:17: note: in expansion of macro '__sunrpc_printk'
30+
42 | __sunrpc_printk(fmt, ##__VA_ARGS__); \
31+
| ^~~~~~~~~~~~~~~
32+
include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
33+
25 | dfprintk(FACILITY, fmt, ##__VA_ARGS__)
34+
| ^~~~~~~~
35+
fs/nfsd/nfs4xdr.c:2646:9: note: in expansion of macro 'dprintk'
36+
2646 | dprintk("nfsd4_encode_components(%s)\n", components);
37+
| ^~~~~~~
38+
fs/nfsd/nfs4xdr.c:2643:13: note: declared here
39+
2643 | int strlen, count=0;
40+
| ^~~~~~
41+
42+
This dprintk() instance is not particularly useful, so just remove it
43+
altogether to get rid of the immediate strlen() conflict.
44+
45+
At the same time, eliminate the local strlen variable to avoid potential
46+
conflicts with strlen() in the future.
47+
48+
Fixes: ec7d8e68ef0e ("sunrpc: add a Kconfig option to redirect dfprintk() output to trace buffer")
49+
Signed-off-by: Nathan Chancellor <[email protected]>
50+
Reviewed-by: NeilBrown <[email protected]>
51+
Signed-off-by: Chuck Lever <[email protected]>
52+
---
53+
Link: https://git.kernel.org/cel/c/c710de671789388b3af1046c7091685594ec44d9
54+
---
55+
fs/nfsd/nfs4xdr.c | 9 +++------
56+
1 file changed, 3 insertions(+), 6 deletions(-)
57+
58+
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
59+
index 8f5ee3014abc81..b689b792c21f2b 100644
60+
--- a/fs/nfsd/nfs4xdr.c
61+
+++ b/fs/nfsd/nfs4xdr.c
62+
@@ -2628,10 +2628,8 @@ static __be32 nfsd4_encode_components_esc(struct xdr_stream *xdr, char sep,
63+
__be32 *p;
64+
__be32 pathlen;
65+
int pathlen_offset;
66+
- int strlen, count=0;
67+
char *str, *end, *next;
68+
-
69+
- dprintk("nfsd4_encode_components(%s)\n", components);
70+
+ int count = 0;
71+
72+
pathlen_offset = xdr->buf->len;
73+
p = xdr_reserve_space(xdr, 4);
74+
@@ -2658,9 +2656,8 @@ static __be32 nfsd4_encode_components_esc(struct xdr_stream *xdr, char sep,
75+
for (; *end && (*end != sep); end++)
76+
/* find sep or end of string */;
77+
78+
- strlen = end - str;
79+
- if (strlen) {
80+
- if (xdr_stream_encode_opaque(xdr, str, strlen) < 0)
81+
+ if (end > str) {
82+
+ if (xdr_stream_encode_opaque(xdr, str, end - str) < 0)
83+
return nfserr_resource;
84+
count++;
85+
} else
86+
--
87+
cgit 1.2.3-korg
88+

patches/mainline/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
20250918_guodong_dmaengine_mmp_pdma_fix_dma_mask_handling.patch
2+
c710de671789388b3af1046c7091685594ec44d9.patch

0 commit comments

Comments
 (0)