From: Cong Wang <xiyou.wangc...@gmail.com>
Date: Tue, 30 Oct 2018 11:09:21 -0700

> On Tue, Oct 30, 2018 at 12:57 AM Eric Dumazet <eduma...@google.com> wrote:
>> -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.

Reply via email to