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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1311773014.2801.23.camel@menhir>
Date:	Wed, 27 Jul 2011 14:23:34 +0100
From:	Steven Whitehouse <swhiteho@...hat.com>
To:	Artem Bityutskiy <Artem.Bityutskiy@...ia.com>,
	Don Mullis <don.mullis@...il.com>,
	Dave Chinner <david@...morbit.com>
Cc:	linux-kernel@...r.kernel.org
Subject: list sort

Hi,

There seems to be an issue with list_sort trying to compare an object to
itself. I spotted it first in a list for which I knew that I had unique
keys, so had put a BUG() in the cmp function if the keys being compared
were equal. While investigating I discovered that the objects themselves
were equal (and hence the keys, also). The following addition to the
list_sort test also triggers twice during the self test:

diff --git a/lib/list_sort.c b/lib/list_sort.c
index d7325c6..afa4a97 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -198,6 +198,8 @@ static int __init cmp(void *priv, struct list_head *a, struct list_head *b)
 {
 	struct debug_el *ela, *elb;
 
+	WARN_ON(a == b);
+
 	ela = container_of(a, struct debug_el, list);
 	elb = container_of(b, struct debug_el, list);
 

While it appears generally harmless, since the list does appear to be
correctly sorted, it is doing extra work needlessly.

I couldn't find a listing in the maintainers' file for list_sort, so
I used git to find those who'd worked on it recently,

Steve.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ