]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit866e823cb6225382db0bf759960fc4a6d4b67877
treeb55f40d28ccf303199b87ff36ae6a951f48db433
parent53fc8a4c89fadcfe360b32582162044b4dd88eaa
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