/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 <qing…@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