Re: [PATCH] drivers/net/wan/hdlc_ppp: fix potential null pointer in ppp_cp_event logging
From: Paolo Abeni
Date: Tue Oct 07 2025 - 04:41:51 EST
On 10/3/25 8:43 AM, Kriish Sharma wrote:
> Thanks for the clarification.
> I can update proto_name() to return "LCP" by default instead of NULL,
> which should silence the compiler without changing behavior.
> I can send another patch for this if you'd like.
If v2 is not ready yet, I think it would be better returning "unknown"
instead of "LCP" when the protocol id is actually unknown.
In the current code base, such case is unexpected/impossible, but the
compiler force us to handle it anyway. I think we should avoid hiding
the unexpected event.
Assuming all the code paths calling proto_name() ensure the pid is a
valid one, you should possibly add a WARN_ONCE() on the default case.
Thanks,
Paolo