[PATCH v2 5/5] 9p: initialize ecode in p9_check_errors()

From: Lianjie Wang

Date: Mon Nov 23 2026 - 15:43:15 EST


An RERROR of 9P2000 has no error code, so p9pdu_readf() returns at the
"?" of the format "s?d" without writing ecode, and p9_check_errors()
prints the uninitialized value with p9_debug() when CONFIG_NET_9P_DEBUG
and P9_DEBUG_9P are set.

Fix this by initializing ecode to zero.

This patch is assisted by Claude Fable 5.2.

Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/sashiko-outbox-206901@xxxxxxxxxx/
Fixes: 51a87c552dfd ("9p: rework client code to use new protocol support functions")
Signed-off-by: Lianjie Wang <lian@xxxxxxxxxxxxxxxxxx>
---
v2:
- New patch.

net/9p/client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index e21d13e274691..482be6f375234 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -400,7 +400,7 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req)
{
s8 type;
int err;
- int ecode;
+ int ecode = 0;

err = p9_parse_header(&req->rc, NULL, &type, NULL, 0);
if (req->rc.size > req->rc.capacity && !req->rc.zc) {
--
2.56.1