ar71xx: avoid possible NULL pointer dereference in ath79_init_{,local}_mac
authorGabor Juhos <juhosg@openwrt.org>
Thu, 27 Sep 2012 20:05:42 +0000 (20:05 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Thu, 27 Sep 2012 20:05:42 +0000 (20:05 +0000)
SVN-Revision: 33575

target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c

index d2d0ee87f07a45c29b54aa26c240d9c90bc08760..4487958bc78cd7cd82e801d55ee633fa34df2988 100644 (file)
@@ -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;
        }