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 855D8A034E; Mon, 14 Feb 2022 17:52:59 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DAEF40DDA; Mon, 14 Feb 2022 17:52:59 +0100 (CET) Received: from office2.cesnet.cz (office2.cesnet.cz [195.113.144.244]) by mails.dpdk.org (Postfix) with ESMTP id 89FC14067E for ; Mon, 14 Feb 2022 17:52:57 +0100 (CET) Received: from [IPv6:2001:67c:1220:80c:eb:e00e:9e81:ff5f] (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 ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id 4C503400074; Mon, 14 Feb 2022 17:52:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2-2020; t=1644857577; bh=jQAGNP6gSYEnOmrUUlnL80IAPyQzDEnaZTQgcUlcwiM=; h=Subject:From:To:Date:In-Reply-To:References; b=SjX30kCe+slvWKT2bBfmC1OR7ALGOOEolV5tf4zhjvoH8gL8wcW+9vLr9cAAYvNvm V/bFWm7VS5PkXYif2TgZ7AuZRNndVYuw3Tsf9fDz0EQHfiNA7/hwIi1sY+fKh33bqb DEe25uXNrHtW5YFPBAZaPcNIOgCLx/LBqBvcxrzvCKbKa033GTmCpnmkSyZyrunoli xpRm4Oe6U6K2qGrnW0gIGwgumkKnXGFKThTpKBAgIMXr7n9GrlKDxkG5XkMV5XW2c1 7j568Ay9ndDSNutBZT3Rf7eEvIiSFmLXdSisvqY2/8o3srpYsnpHXwhIzM5n0dumiJ 916mYlPiiR5dg== Message-ID: <5dbe4fab0d710250191d842956062c42bca6e2d2.camel@cesnet.cz> Subject: Re: [PATCH 2/6] drivers/nfb: fix array indexes in deinit functions From: Martin Spinler To: Ferruh Yigit , dev@dpdk.org Date: Mon, 14 Feb 2022 17:52:55 +0100 In-Reply-To: <2a4708db-c0f8-d883-d4a1-b775e0dd8fc5@intel.com> References: <20220214112541.29782-1-spinler@cesnet.cz> <20220214112541.29782-2-spinler@cesnet.cz> <2a4708db-c0f8-d883-d4a1-b775e0dd8fc5@intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 Hi Ferruh, thanks for all comments in this series. On Mon, 2022-02-14 at 13:34 +0000, Ferruh Yigit wrote: > On 2/14/2022 11:25 AM, spinler@cesnet.cz wrote: > > From: Martin Spinler > > > > The indexes in the for cycle were wrongly used and > > the code accessed outside of the rxmac/txmac array. > > > > can you please add fixes tag, to help backport. > Also please add stable tag to request backport. Tags will be added in v2. > > > 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; > > } > > } > > >