can: mcp25xxfd: fix a leak in mcp25xxfd_ring_free()
Subsystems (4)
PATCH 1/1 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 <[email protected]>
--- drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c +1 -1
@@ -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 ; }
Signature · 1 line
2.28.0
Quoted 5 lines · Dan Carpenter
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 <[email protected]>
Applied to linux-can-next
Tnx,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |