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>] [day] [month] [year] [list]
Message-ID: <20080328122534.GL3613@spacedout.fries.net>
Date:	Fri, 28 Mar 2008 07:25:34 -0500
From:	David Fries <david@...es.net>
To:	linux-kernel@...r.kernel.org
Cc:	Evgeniy Polyakov <johnpol@....mipt.ru>
Subject: [PATCH 11/35] W1: recode w1_slave_found logic

w1.c 1.14
Rewrote the confusion logic in w1_slave_found.  The function is called
for each device detected by a bus search.  If the slave was found a
flag is set to show that it is still active.  If it wasn't found it
will be attached.

It would previously search through the slave list marking the slave
active if it was found.  It used a counter to determine if it exited
the loop early.  If it searched through all slaves in the list the crc
value was verified and then attached the device if it did.

Now it uses the new w1_attach_slave_device function to find the slave
device and mark the device active if it was found.  If the slave
wasn't found it will add the device if the crc is correct.  Much more
understandable.

Signed-off-by: David Fries <david@...es.net>
---
 drivers/w1/w1.c |   24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 3ca1f4d..b18eedb 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -814,24 +814,12 @@ static void w1_slave_found(struct w1_master *dev, u64 rn)
 
 	tmp = (struct w1_reg_num *) &rn;
 
-	slave_count = 0;
-	list_for_each(ent, &dev->slist) {
-
-		sl = list_entry(ent, struct w1_slave, w1_slave_entry);
-
-		if (sl->reg_num.family == tmp->family &&
-		    sl->reg_num.id == tmp->id &&
-		    sl->reg_num.crc == tmp->crc) {
-			set_bit(W1_SLAVE_ACTIVE, (long *)&sl->flags);
-			break;
-		}
-
-		slave_count++;
-	}
-
-	if (slave_count == dev->slave_count &&
-		rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn_le, 7)) {
-		w1_attach_slave_device(dev, tmp);
+	sl = w1_slave_search_device(dev, tmp);
+	if(sl) {
+		set_bit(W1_SLAVE_ACTIVE, (long *)&sl->flags);
+	} else {
+		if(rn && tmp->crc == w1_calc_crc8((u8 *)&rn_le, 7))
+			w1_attach_slave_device(dev, tmp);
 	}
 
 	atomic_dec(&dev->refcnt);
-- 
1.4.4.4

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ