Re: [PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS
From: David Miller <davem@davemloft.net>
Date: 2018-10-31 03:37:57
From: David Miller <davem@davemloft.net>
Date: 2018-10-31 03:37:57
From: Cong Wang <redacted> Date: Tue, 30 Oct 2018 11:09:21 -0700
On Tue, Oct 30, 2018 at 12:57 AM Eric Dumazet [off-list ref] wrote:quoted
-static __be32 mlx5e_get_fcs(struct sk_buff *skb) +static u32 mlx5e_get_fcs(const struct sk_buff *skb) { - int last_frag_sz, bytes_in_prev, nr_frags; - u8 *fcs_p1, *fcs_p2; - skb_frag_t *last_frag; - __be32 fcs_bytes; + const void *fcs_bytes; + u32 _fcs_bytes; - if (!skb_is_nonlinear(skb)) - return *(__be32 *)(skb->data + skb->len - ETH_FCS_LEN); + fcs_bytes = skb_header_pointer(skb, skb->len - ETH_FCS_LEN, + ETH_FCS_LEN, &_fcs_bytes);At least skb_header_pointer() is marked as __must_check, I don't see you check its return value here.
In this case we reasonably know it is guaranteed to succeed though. We know skb->len is non-zero and we are asking for the skb->len - 1 byte or something like that.