Re: [PATCH net-next v3] hdlc_ppp: fix potential null pointer in ppp_cp_event logging

From: Krzysztof Hałasa

Date: Tue Oct 14 2025 - 00:26:55 EST


Kriish Sharma <kriish.sharma2006@xxxxxxxxx> writes:

> 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@xxxxxxx>
> Signed-off-by: Kriish Sharma <kriish.sharma2006@xxxxxxxxx>

Thanks, and
Acked-by: Krzysztof Hałasa <khalasa@xxxxxxx>

> --- 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";
> }
> }
>
--
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa