diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-09-23 14:27:52 +0300 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2020-09-30 11:34:30 +0300 |
commit | 8cffc6fe65108e66c8cfe46307bf2325a4434056 (patch) | |
tree | 76b91f2715f450bec759fee09b49dc0fa16cf3d2 /drivers/net/can/spi | |
parent | f5b84dedf7ebf56f4af25b72aadd1a4122759b62 (diff) | |
download | linux-8cffc6fe65108e66c8cfe46307bf2325a4434056.tar.xz |
can: mcp25xxfd: mcp25xxfd_ring_free(): fix memory leak during cleanup
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@oracle.com>
Link: https://lore.kernel.org/r/20200923112752.GA1473821@mwanda
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/spi')
-rw-r--r-- | drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c index c094bb716256..b91180b560fd 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; } |