Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: gianfar: Use __be64 * to store pointers to big endian values

Timestamp values are read using pointers to 64-bit big endian values.
But the type of these pointers is u64 *, host byte order.
Use __be64 * instead.

Flagged by Sparse:

.../gianfar.c:2212:60: warning: cast to restricted __be64
.../gianfar.c:2475:53: warning: cast to restricted __be64

Introduced by
commit cc772ab7cdca ("gianfar: Add hardware RX timestamping support").

Compile tested only.
No functional change intended.

Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Link: https://patch.msgid.link/20241011-gianfar-be64-v1-1-a77ebe972176@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Simon Horman and committed by
Paolo Abeni
de306f00 bb9df28e

+4 -3
+4 -3
drivers/net/ethernet/freescale/gianfar.c
··· 2207 2207 2208 2208 if (unlikely(do_tstamp)) { 2209 2209 struct skb_shared_hwtstamps shhwtstamps; 2210 - u64 *ns = (u64 *)(((uintptr_t)skb->data + 0x10) & 2211 - ~0x7UL); 2210 + __be64 *ns; 2211 + 2212 + ns = (__be64 *)(((uintptr_t)skb->data + 0x10) & ~0x7UL); 2212 2213 2213 2214 memset(&shhwtstamps, 0, sizeof(shhwtstamps)); 2214 2215 shhwtstamps.hwtstamp = ns_to_ktime(be64_to_cpu(*ns)); ··· 2472 2471 /* Get receive timestamp from the skb */ 2473 2472 if (priv->hwts_rx_en) { 2474 2473 struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); 2475 - u64 *ns = (u64 *) skb->data; 2474 + __be64 *ns = (__be64 *)skb->data; 2476 2475 2477 2476 memset(shhwtstamps, 0, sizeof(*shhwtstamps)); 2478 2477 shhwtstamps->hwtstamp = ns_to_ktime(be64_to_cpu(*ns));