aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-09-27 20:05:42 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-09-27 20:05:42 +0000
commitf2c23625e1ec3c4b7ab03c99f45c1e77ee0f27c2 (patch)
tree5881ff8657ed29d7847d747a3b944be3433b9262
parent0af43078601691160247ed95effd8aeac24a9b3a (diff)
downloadmaster-187ad058-f2c23625e1ec3c4b7ab03c99f45c1e77ee0f27c2.tar.gz
master-187ad058-f2c23625e1ec3c4b7ab03c99f45c1e77ee0f27c2.tar.bz2
master-187ad058-f2c23625e1ec3c4b7ab03c99f45c1e77ee0f27c2.zip
ar71xx: avoid possible NULL pointer dereference in ath79_init_{,local}_mac
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33575 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
index d2d0ee87f0..4487958bc7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -992,7 +992,10 @@ void __init ath79_init_mac(unsigned char *dst, const unsigned char *src,
{
int t;
- if (!is_valid_ether_addr(src)) {
+ if (!dst)
+ return;
+
+ if (!src || !is_valid_ether_addr(src)) {
memset(dst, '\0', ETH_ALEN);
return;
}
@@ -1012,7 +1015,10 @@ void __init ath79_init_local_mac(unsigned char *dst, const unsigned char *src)
{
int i;
- if (!is_valid_ether_addr(src)) {
+ if (!dst)
+ return;
+
+ if (!src || !is_valid_ether_addr(src)) {
memset(dst, '\0', ETH_ALEN);
return;
}