All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: netdev@vger.kernel.org
Cc: Chaithrika U S <chaithrika@ti.com>, Sriramakrishnan <srk@ti.com>,
	"David S. Miller" <davem@davemloft.net>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	Anant Gole <anantgole@ti.com>,
	kernel-janitors@vger.kernel.org
Subject: [patch] davinci_emac: off by one
Date: Wed, 03 Mar 2010 07:07:24 +0000	[thread overview]
Message-ID: <20100303070724.GC5086@bicker> (raw)

This off by one error was found by smatch.

drivers/net/davinci_emac.c +2390 emac_dev_open(13) error: buffer overflow 'priv->mac_addr' 6 <= 6

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
I don't have the hardware to test this.  If would be cool if someone
would verify that the hardware still works after the patch is applied.

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 1605bc2..eab07cd 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2386,7 +2386,7 @@ static int emac_dev_open(struct net_device *ndev)
 	struct emac_priv *priv = netdev_priv(ndev);
 
 	netif_carrier_off(ndev);
-	for (cnt = 0; cnt <= ETH_ALEN; cnt++)
+	for (cnt = 0; cnt < ETH_ALEN; cnt++)
 		ndev->dev_addr[cnt] = priv->mac_addr[cnt];
 
 	/* Configuration items */

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: netdev@vger.kernel.org
Cc: Chaithrika U S <chaithrika@ti.com>, Sriramakrishnan <srk@ti.com>,
	"David S. Miller" <davem@davemloft.net>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	Anant Gole <anantgole@ti.com>,
	kernel-janitors@vger.kernel.org
Subject: [patch] davinci_emac: off by one
Date: Wed, 3 Mar 2010 10:07:24 +0300	[thread overview]
Message-ID: <20100303070724.GC5086@bicker> (raw)

This off by one error was found by smatch.

drivers/net/davinci_emac.c +2390 emac_dev_open(13) error: buffer overflow 'priv->mac_addr' 6 <= 6

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
I don't have the hardware to test this.  If would be cool if someone
would verify that the hardware still works after the patch is applied.

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 1605bc2..eab07cd 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2386,7 +2386,7 @@ static int emac_dev_open(struct net_device *ndev)
 	struct emac_priv *priv = netdev_priv(ndev);
 
 	netif_carrier_off(ndev);
-	for (cnt = 0; cnt <= ETH_ALEN; cnt++)
+	for (cnt = 0; cnt < ETH_ALEN; cnt++)
 		ndev->dev_addr[cnt] = priv->mac_addr[cnt];
 
 	/* Configuration items */

             reply	other threads:[~2010-03-03  7:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-03  7:07 Dan Carpenter [this message]
2010-03-03  7:07 ` [patch] davinci_emac: off by one Dan Carpenter
2010-03-03  9:08 ` David Miller
2010-03-03  9:08   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100303070724.GC5086@bicker \
    --to=error27@gmail.com \
    --cc=anantgole@ti.com \
    --cc=chaithrika@ti.com \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=khilman@deeprootsystems.com \
    --cc=netdev@vger.kernel.org \
    --cc=srk@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.