Message ID | 20220306085658.1943-2-gerhard@engleder-embedded.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ptp: Support hardware clocks with additional free running time | expand |
diff --git a/net/core/filter.c b/net/core/filter.c index 88767f7da150..09e202b60060 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -9364,13 +9364,12 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type, break; case offsetof(struct __sk_buff, hwtstamp): BUILD_BUG_ON(sizeof_field(struct skb_shared_hwtstamps, hwtstamp) != 8); - BUILD_BUG_ON(offsetof(struct skb_shared_hwtstamps, hwtstamp) != 0); insn = bpf_convert_shinfo_access(si, insn); *insn++ = BPF_LDX_MEM(BPF_DW, si->dst_reg, si->dst_reg, bpf_target_off(struct skb_shared_info, - hwtstamps, 8, + hwtstamps.hwtstamp, 8, target_size)); break; }
skb_shared_hwtstamps contains only the field hwtstamp. That property is hard-coded and checked during build in BPF. bpf_target_off() gets the whole structure as argument (hwtstamps) instead of the actually accessed field hwtstamp. Access hwtstamp field directly and allow future extensions of skb_shared_hwtstamps. Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com> --- net/core/filter.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)