* [PATCH net-next] pppoe: make the session ID byte order explicit in procfs
@ 2026-12-01 4:00 Qingfang Deng
2026-12-03 17:03 ` Nicolas Dichtel
0 siblings, 1 reply; 2+ messages in thread
From: Qingfang Deng @ 2026-12-01 4:00 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Qingfang Deng, Simon Horman, Eric Woudstra,
Asim Viladi Oglu Manizada, Felix Fietkau, netdev
/proc/net/pppoe prints the network-order session ID as a native-endian
integer. A session ID of 0x1234 therefore appears as 00003412 on
little-endian hosts and 00001234 on big-endian hosts.
Explicitly cast the ID to u16 to document this ABI, so a static analysis
tool won't trip on it. Converting it to host byte order would change
what little-endian userspace reads.
Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
---
drivers/net/ppp/pppoe.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index de6edc31790f..4b839f1d10aa 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -929,8 +929,9 @@ static int pppoe_seq_show(struct seq_file *seq, void *v)
po = v;
dev_name = po->pppoe_pa.dev;
- seq_printf(seq, "%08X %pM %8s\n",
- po->pppoe_pa.sid, po->pppoe_pa.remote, dev_name);
+ /* The procfs ABI treats the network-order SID as a native u16. */
+ seq_printf(seq, "%08X %pM %8s\n", (__force u16)po->pppoe_pa.sid,
+ po->pppoe_pa.remote, dev_name);
out:
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] pppoe: make the session ID byte order explicit in procfs
2026-12-01 4:00 [PATCH net-next] pppoe: make the session ID byte order explicit in procfs Qingfang Deng
@ 2026-12-03 17:03 ` Nicolas Dichtel
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Dichtel @ 2026-12-03 17:03 UTC (permalink / raw)
To: Qingfang Deng, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Eric Woudstra,
Asim Viladi Oglu Manizada, Felix Fietkau, netdev
Le 01/12/2026 à 05:00, Qingfang Deng a écrit :> /proc/net/pppoe prints the
network-order session ID as a native-endian
> integer. A session ID of 0x1234 therefore appears as 00003412 on
> little-endian hosts and 00001234 on big-endian hosts.
>
> Explicitly cast the ID to u16 to document this ABI, so a static analysis
> tool won't trip on it. Converting it to host byte order would change
> what little-endian userspace reads.
Which tool, and what does it report? If sparse warns on the current code, please
quote the warning in the commit log. Otherwise this looks like a pure cleanup.
Nit: the cast does not make the byte order explicit, it documents that no
conversion is done. Something like "pppoe: document the raw session ID in
procfs" may be more accurate.
Regards,
Nicolas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-03 17:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 4:00 [PATCH net-next] pppoe: make the session ID byte order explicit in procfs Qingfang Deng
2026-12-03 17:03 ` Nicolas Dichtel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox