[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101220092601.GS1936@bicker>
Date: Mon, 20 Dec 2010 12:26:01 +0300
From: Dan Carpenter <error27@...il.com>
To: Wolfgang Grandegger <wg@...ndegger.com>
Cc: socketcan-core@...ts.berlios.de, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [patch -next] pch_can: off by one bugs
priv->tx_enable[] has PCH_TX_OBJ_END elements so this code is
reading and writing one past the end of the array.
Signed-off-by: Dan Carpenter <error27@...il.com>
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index 8d45fdd..b2c1292 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -1077,7 +1077,7 @@ static int pch_can_suspend(struct pci_dev *pdev, pm_message_t state)
pch_can_set_int_enables(priv, PCH_CAN_DISABLE);
/* Save Tx buffer enable state */
- for (i = PCH_TX_OBJ_START; i <= PCH_TX_OBJ_END; i++)
+ for (i = PCH_TX_OBJ_START; i < PCH_TX_OBJ_END; i++)
priv->tx_enable[i] = pch_can_get_rxtx_ir(priv, i, PCH_TX_IFREG);
/* Disable all Transmit buffers */
@@ -1138,7 +1138,7 @@ static int pch_can_resume(struct pci_dev *pdev)
pch_can_set_optmode(priv);
/* Enabling the transmit buffer. */
- for (i = PCH_TX_OBJ_START; i <= PCH_TX_OBJ_END; i++)
+ for (i = PCH_TX_OBJ_START; i < PCH_TX_OBJ_END; i++)
pch_can_set_rxtx(priv, i, priv->tx_enable[i], PCH_TX_IFREG);
/* Configuring the receive buffer and enabling them. */
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists