net: atlantic: fix "frag[0] not initialized"
authorGrant Grundler <grundler@chromium.org>
Tue, 10 May 2022 02:28:23 +0000 (19:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 May 2022 11:25:07 +0000 (12:25 +0100)
commit62e0ae0f4020250f961cf8d0103a4621be74e077
treeb55f40d28ccf303199b87ff36ae6a951f48db433
parent0807ce0b010418a191e0e4009803b2d74c3245d5
net: atlantic: fix "frag[0] not initialized"

In aq_ring_rx_clean(), if buff->is_eop is not set AND
buff->len < AQ_CFG_RX_HDR_SIZE, then hdr_len remains equal to
buff->len and skb_add_rx_frag(xxx, *0*, ...) is not called.

The loop following this code starts calling skb_add_rx_frag() starting
with i=1 and thus frag[0] is never initialized. Since i is initialized
to zero at the top of the primary loop, we can just reference and
post-increment i instead of hardcoding the 0 when calling
skb_add_rx_frag() the first time.

Reported-by: Aashay Shringarpure <aashay@google.com>
Reported-by: Yi Chou <yich@google.com>
Reported-by: Shervin Oloumi <enlightened@google.com>
Signed-off-by: Grant Grundler <grundler@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/aq_ring.c