From: Kriish Sharma Date: Mon, 13 Oct 2025 01:43:19 +0000 (+0000) Subject: hdlc_ppp: fix potential null pointer in ppp_cp_event logging X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3dacc900c00bad7275ee8c096dbcaab699d83e36;p=thirdparty%2Fkernel%2Flinux.git hdlc_ppp: fix potential null pointer in ppp_cp_event logging 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 Signed-off-by: Kriish Sharma Acked-by: Krzysztof Hałasa Link: https://patch.msgid.link/20251013014319.1608706-1-kriish.sharma2006@gmail.com Signed-off-by: Paolo Abeni --- diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c index 7496a2e9a2820..159295c4bd6d8 100644 --- a/drivers/net/wan/hdlc_ppp.c +++ b/drivers/net/wan/hdlc_ppp.c @@ -126,14 +126,12 @@ static inline struct proto *get_proto(struct net_device *dev, u16 pid) static inline const char *proto_name(u16 pid) { switch (pid) { - case PID_LCP: - return "LCP"; case PID_IPCP: return "IPCP"; case PID_IPV6CP: return "IPV6CP"; default: - return NULL; + return "LCP"; } }