From: Dan Carpenter <dan.carpenter@oracle•com>
To: "David S. Miller" <davem@davemloft•net>
Cc: Tristram.Ha@micrel•com, Ben Hutchings <bhutchings@solarflare•com>,
netdev@vger•kernel.org
Subject: [patch] ksz884x: don't copy too much in netdev_set_mac_address()
Date: Thu, 19 Apr 2012 10:00:19 +0300 [thread overview]
Message-ID: <20120419070018.GA16645@elgon.mountain> (raw)
In-Reply-To: <1334758394.3209.156.camel@deadeye>
MAX_ADDR_LEN is 32. ETH_ALEN is 6. mac->sa_data is a 14 byte array, so
the memcpy() is doing a read past the end of the array. I asked about
this on netdev and Ben Hutchings told me it's supposed to be copying
ETH_ALEN bytes (thanks Ben).
Signed-off-by: Dan Carpenter <dan.carpenter@oracle•com>
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index ef723b1..eaf9ff0 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -5675,7 +5675,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr)
memcpy(hw->override_addr, mac->sa_data, ETH_ALEN);
}
- memcpy(dev->dev_addr, mac->sa_data, MAX_ADDR_LEN);
+ memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN);
interrupt = hw_block_intr(hw);
next prev parent reply other threads:[~2012-04-19 7:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-18 6:47 net: Micrel KSZ8841/2 PCI Ethernet driver Dan Carpenter
2012-04-18 14:13 ` Ben Hutchings
2012-04-18 14:51 ` Dan Carpenter
2012-04-19 7:00 ` Dan Carpenter [this message]
2012-04-19 17:25 ` [patch] ksz884x: don't copy too much in netdev_set_mac_address() 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=20120419070018.GA16645@elgon.mountain \
--to=dan.carpenter@oracle$(echo .)com \
--cc=Tristram.Ha@micrel$(echo .)com \
--cc=bhutchings@solarflare$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox