[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251003092918.1428164-1-kriish.sharma2006@gmail.com>
Date: Fri, 3 Oct 2025 09:29:18 +0000
From: Kriish Sharma <kriish.sharma2006@...il.com>
To: khalasa@...p.pl,
khc@...waw.pl,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com
Cc: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Kriish Sharma <kriish.sharma2006@...il.com>
Subject: [PATCH net v2] hdlc_ppp: fix potential null pointer in ppp_cp_event logging
Fixes warnings observed during compilation with -Wformat-overflow:
drivers/net/wan/hdlc_ppp.c: In function ‘ppp_cp_event’:
drivers/net/wan/hdlc_ppp.c:353:17: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
353 | netdev_info(dev, "%s down\n", proto_name(pid));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wan/hdlc_ppp.c:342:17: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
342 | netdev_info(dev, "%s up\n", proto_name(pid));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update proto_name() to return "LCP" by default instead of NULL.
This change silences the compiler without changing existing behavior
and removes the need for the local 'pname' variable in ppp_cp_event.
Suggested-by: Krzysztof Hałasa <khalasa@...p.pl>
Fixes: 262858079afd ("Add linux-next specific files for 20250926")
Signed-off-by: Kriish Sharma <kriish.sharma2006@...il.com>
---
v2:
- Target the net tree with proper subject prefix "[PATCH net]"
- Update proto_name() to return "LCP" by default instead of NULL
- Remove local 'pname' variable in ppp_cp_event
- Add Suggested-by tag for Krzysztof Hałasa
v1: https://lore.kernel.org/all/20251002180541.1375151-1-kriish.sharma2006@gmail.com/
drivers/net/wan/hdlc_ppp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index 7496a2e9a282..281699e8d799 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -133,7 +133,7 @@ static inline const char *proto_name(u16 pid)
case PID_IPV6CP:
return "IPV6CP";
default:
- return NULL;
+ return "LCP";
}
}
--
2.34.1
Powered by blists - more mailing lists