[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200923112752.GA1473821@mwanda>
Date: Wed, 23 Sep 2020 14:27:52 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Marc Kleine-Budde <mkl@...gutronix.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Thomas Kopp <thomas.kopp@...rochip.com>,
Wolfgang Grandegger <wg@...ndegger.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, linux-can@...r.kernel.org,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH net-next] can: mcp25xxfd: fix a leak in mcp25xxfd_ring_free()
This loop doesn't free the first element of the array. The "i > 0" has
to be changed to "i >= 0".
Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
index bd2ba981ae36..7e094afaac04 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
@@ -377,7 +377,7 @@ static void mcp25xxfd_ring_free(struct mcp25xxfd_priv *priv)
{
int i;
- for (i = ARRAY_SIZE(priv->rx) - 1; i > 0; i--) {
+ for (i = ARRAY_SIZE(priv->rx) - 1; i >= 0; i--) {
kfree(priv->rx[i]);
priv->rx[i] = NULL;
}
--
2.28.0
Powered by blists - more mailing lists