* [PATCH net-next] can: mcp25xxfd: fix a leak in mcp25xxfd_ring_free()
@ 2020-09-23 11:27 Dan Carpenter
2020-09-23 11:53 ` Marc Kleine-Budde
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-09-23 11:27 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Manivannan Sadhasivam, Thomas Kopp, Wolfgang Grandegger,
David S. Miller, Jakub Kicinski, linux-can, netdev,
kernel-janitors
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] can: mcp25xxfd: fix a leak in mcp25xxfd_ring_free()
2020-09-23 11:27 [PATCH net-next] can: mcp25xxfd: fix a leak in mcp25xxfd_ring_free() Dan Carpenter
@ 2020-09-23 11:53 ` Marc Kleine-Budde
0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2020-09-23 11:53 UTC (permalink / raw)
To: Dan Carpenter
Cc: Manivannan Sadhasivam, Thomas Kopp, Wolfgang Grandegger,
David S. Miller, Jakub Kicinski, linux-can, netdev,
kernel-janitors
[-- Attachment #1.1: Type: text/plain, Size: 612 bytes --]
On 9/23/20 1:27 PM, Dan Carpenter wrote:
> 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>
Applied to linux-can-next
Tnx,
Marc
--
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 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-23 11:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-23 11:27 [PATCH net-next] can: mcp25xxfd: fix a leak in mcp25xxfd_ring_free() Dan Carpenter
2020-09-23 11:53 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).