[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <m3347vszzx.fsf@t19.piap.pl>
Date: Tue, 07 Oct 2025 13:38:42 +0200
From: Krzysztof Hałasa <khalasa@...p.pl>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Kriish Sharma <kriish.sharma2006@...il.com>, khc@...waw.pl,
andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers/net/wan/hdlc_ppp: fix potential null pointer in
ppp_cp_event logging
Paolo Abeni <pabeni@...hat.com> writes:
> Note that the suggested change is not going to change any semantic, just
> make it clear for future changes that such case is not really
> expected.
But there is no "other case", any numeric argument this function is
called with is expected. This is not a hdlc-ppp-wide function. Such
a function was simply not needed. That the function returned NULL in an
impossible case is just, I guess, my coding deficiency. Not my worst,
though :-)
Would you rather like #define proto_name(x) ((x) == PID_LCP ? "LCP" : (x)
== PID_IPCP ? "IPCP" : "IPV6CP")? Or maybe you would like the "unknown"
case there as well?
This function is for only those 3 protocols, all of them being "control
protocols": IP control protocol, IPv6 control protocol, and link control
protocol. Think of it as of
enum control_protocols {LCP, IP, IPV6};
proto_name(enum control_protocols)
...
You must not call this function in any other context, e.g. it's not OK
to call it with PID_IP nor PID_IPV6 (which are otherwise perfectly valid
PIDs in this very file).
If the function's name is misleading, perhaps it could be extended to
control_proto_name(). Not that I find such changes entertaining, but it
would be technically correct after all.
HTH,
--
Krzysztof "Chris" Hałasa
Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa
Powered by blists - more mailing lists