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-next>] [day] [month] [year] [list]
Message-Id: <1376694473-8517-1-git-send-email-lekensteyn@gmail.com>
Date:	Sat, 17 Aug 2013 01:07:53 +0200
From:	Peter Wu <lekensteyn@...il.com>
To:	Ben Hutchings <bhutchings@...arflare.com>,
	Francois Romieu <romieu@...zoreil.com>
Cc:	lekensteyn@...il.com, netdev@...r.kernel.org
Subject: [PATCH] r8169,sis190: remove unnecessary length check

The ethtool core will lower the requested length to the one returned by
get_regs_len, therefore no additional check is needed in the get_regs
function.

Reported-by: Ben Hutchings <bhutchings@...arflare.com>
Signed-off-by: Peter Wu <lekensteyn@...il.com>
---
Hi,

This was observed by Ben[1] while reviewing my other r8169 register dump
patch. I have combined the r8169 and sis190 patches since they were
trivial and both maintained by Francois. Let me know if you prefer to
split this trivial patch up.

Regards,
Peter

 [1]: http://www.spinics.net/lists/netdev/msg246690.html
---
 drivers/net/ethernet/realtek/r8169.c | 3 ---
 drivers/net/ethernet/sis/sis190.c    | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index b5eb419..93ee49d 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1898,9 +1898,6 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
 
-	if (regs->len > R8169_REGS_SIZE)
-		regs->len = R8169_REGS_SIZE;
-
 	rtl_lock_work(tp);
 	memcpy_fromio(p, tp->mmio_addr, regs->len);
 	rtl_unlock_work(tp);
diff --git a/drivers/net/ethernet/sis/sis190.c b/drivers/net/ethernet/sis/sis190.c
index 02df089..ee18e6f 100644
--- a/drivers/net/ethernet/sis/sis190.c
+++ b/drivers/net/ethernet/sis/sis190.c
@@ -1770,9 +1770,6 @@ static void sis190_get_regs(struct net_device *dev, struct ethtool_regs *regs,
 	struct sis190_private *tp = netdev_priv(dev);
 	unsigned long flags;
 
-	if (regs->len > SIS190_REGS_SIZE)
-		regs->len = SIS190_REGS_SIZE;
-
 	spin_lock_irqsave(&tp->lock, flags);
 	memcpy_fromio(p, tp->mmio_addr, regs->len);
 	spin_unlock_irqrestore(&tp->lock, flags);
-- 
1.8.3.4

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