lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110205021710.8510.44761.stgit@savbu-pc100.cisco.com>
Date:	Fri, 04 Feb 2011 18:17:10 -0800
From:	Vasanthy Kolluri <vkolluri@...co.com>
To:	davem@...emloft.net
Cc:	netdev@...r.kernel.org
Subject: [net-next-2.6 PATCH 2/5] enic: Bug Fix: Fix return values of
	enic_add/del_station_addr routines

From: Vasanthy Kolluri <vkolluri@...co.com>

Fix enic_add/del_station_addr routines to return appropriate error code when an invalid address is added or deleted.

Signed-off-by: Christian Benvenuti <benve@...co.com>
Signed-off-by: Vasanthy Kolluri <vkolluri@...co.com>
Signed-off-by: Roopa Prabhu <roprabhu@...co.com>
Signed-off-by: David Wang <dwang2@...co.com>
---
 drivers/net/enic/enic.h     |    2 +-
 drivers/net/enic/enic_dev.c |   26 ++++++++++++++------------
 2 files changed, 15 insertions(+), 13 deletions(-)


diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 1385a60..f38ad63 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -32,7 +32,7 @@
 
 #define DRV_NAME		"enic"
 #define DRV_DESCRIPTION		"Cisco VIC Ethernet NIC Driver"
-#define DRV_VERSION		"2.1.1.3"
+#define DRV_VERSION		"2.1.1.4"
 #define DRV_COPYRIGHT		"Copyright 2008-2011 Cisco Systems, Inc"
 
 #define ENIC_BARS_MAX		6
diff --git a/drivers/net/enic/enic_dev.c b/drivers/net/enic/enic_dev.c
index a52dbd2..3826266 100644
--- a/drivers/net/enic/enic_dev.c
+++ b/drivers/net/enic/enic_dev.c
@@ -49,26 +49,28 @@ int enic_dev_stats_dump(struct enic *enic, struct vnic_stats **vstats)
 
 int enic_dev_add_station_addr(struct enic *enic)
 {
-	int err = 0;
+	int err;
+
+	if (!is_valid_ether_addr(enic->netdev->dev_addr))
+		return -EADDRNOTAVAIL;
 
-	if (is_valid_ether_addr(enic->netdev->dev_addr)) {
-		spin_lock(&enic->devcmd_lock);
-		err = vnic_dev_add_addr(enic->vdev, enic->netdev->dev_addr);
-		spin_unlock(&enic->devcmd_lock);
-	}
+	spin_lock(&enic->devcmd_lock);
+	err = vnic_dev_add_addr(enic->vdev, enic->netdev->dev_addr);
+	spin_unlock(&enic->devcmd_lock);
 
 	return err;
 }
 
 int enic_dev_del_station_addr(struct enic *enic)
 {
-	int err = 0;
+	int err;
+
+	if (!is_valid_ether_addr(enic->netdev->dev_addr))
+		return -EADDRNOTAVAIL;
 
-	if (is_valid_ether_addr(enic->netdev->dev_addr)) {
-		spin_lock(&enic->devcmd_lock);
-		err = vnic_dev_del_addr(enic->vdev, enic->netdev->dev_addr);
-		spin_unlock(&enic->devcmd_lock);
-	}
+	spin_lock(&enic->devcmd_lock);
+	err = vnic_dev_del_addr(enic->vdev, enic->netdev->dev_addr);
+	spin_unlock(&enic->devcmd_lock);
 
 	return err;
 }

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ