[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181030.114318.1408411387716516189.davem@davemloft.net>
Date: Tue, 30 Oct 2018 11:43:18 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: xiyou.wangcong@...il.com
Cc: edumazet@...gle.com, netdev@...r.kernel.org,
eric.dumazet@...il.com, eranbe@...lanox.com, saeedm@...lanox.com,
dmichail@...gle.com, pstaszewski@...are.pl
Subject: Re: [PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS
From: Cong Wang <xiyou.wangcong@...il.com>
Date: Tue, 30 Oct 2018 11:09:21 -0700
> On Tue, Oct 30, 2018 at 12:57 AM Eric Dumazet <edumazet@...gle.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.
Powered by blists - more mailing lists