From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A78B5A00C5; Mon, 14 Feb 2022 12:25:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18B9141141; Mon, 14 Feb 2022 12:25:47 +0100 (CET) Received: from office2.cesnet.cz (office2.cesnet.cz [195.113.144.244]) by mails.dpdk.org (Postfix) with ESMTP id F21F541141 for ; Mon, 14 Feb 2022 12:25:45 +0100 (CET) Received: from emil.fit.vutbr.cz (unknown [IPv6:2001:67c:1220:80c:eb:e00e:9e81:ff5f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id 860B5400072; Mon, 14 Feb 2022 12:25:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2-2020; t=1644837945; bh=y+z9sKE3Y1+UQZtXR5zQzNb9NxWC0xB7CeMAcnCGAUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=V0+8m7xefGj0gDUb/6Qw4vxSKH5jYl4eZ8aHOL+5cSwM2D228ymsd/p9QXzuWVe1P HruRUrhaCaVtMAz0XZC36B9OMVsBkEYgVd4j//dodC2Smc4Ll9q+GVSRT9AYRxprYA h2PAzNIdvjyGTTDkwhce7v78/VNY9zPRA2bikK81b2TuFmU56OSqLaZnpnjJBhwxb+ e8J7XdtkdtKdLCfHkjsjjnzWal6/5m7CAIyrzPgkqE08gBYBD5OISwzRKeTSHDSyYf s9DXQVdqmbPykaagdk5IHnxClzk6TnccHIRslizCCqTPuNNZXAU68MMcf6jtlV3sRf KyJnp1+QHN8Rw== From: spinler@cesnet.cz To: dev@dpdk.org Cc: Martin Spinler Subject: [PATCH 2/6] drivers/nfb: fix array indexes in deinit functions Date: Mon, 14 Feb 2022 12:25:37 +0100 Message-Id: <20220214112541.29782-2-spinler@cesnet.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214112541.29782-1-spinler@cesnet.cz> References: <20220214112541.29782-1-spinler@cesnet.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Martin Spinler The indexes in the for cycle were wrongly used and the code accessed outside of the rxmac/txmac array. Signed-off-by: Martin Spinler --- drivers/net/nfb/nfb_ethdev.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c index 3c39937816..0b27fe78cc 100644 --- a/drivers/net/nfb/nfb_ethdev.c +++ b/drivers/net/nfb/nfb_ethdev.c @@ -77,9 +77,10 @@ static void nfb_nc_rxmac_deinit(struct nc_rxmac *rxmac[RTE_MAX_NC_RXMAC], uint16_t max_rxmac) { - for (; max_rxmac > 0; --max_rxmac) { - nc_rxmac_close(rxmac[max_rxmac]); - rxmac[max_rxmac] = NULL; + uint16_t i; + for (i = 0; i < max_rxmac; i++) { + nc_rxmac_close(rxmac[i]); + rxmac[i] = NULL; } } @@ -95,9 +96,10 @@ static void nfb_nc_txmac_deinit(struct nc_txmac *txmac[RTE_MAX_NC_TXMAC], uint16_t max_txmac) { - for (; max_txmac > 0; --max_txmac) { - nc_txmac_close(txmac[max_txmac]); - txmac[max_txmac] = NULL; + uint16_t i; + for (i = 0; i < max_txmac; i++) { + nc_txmac_close(txmac[i]); + txmac[i] = NULL; } } -- 2.35.1