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-prev] [day] [month] [year] [list]
Date:	Mon, 10 Sep 2012 14:18:51 +0200
From:	Sasha Levin <levinsasha928@...il.com>
To:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
CC:	torvalds@...ux-foundation.org, tj@...nel.org,
	linux-kernel@...r.kernel.org, rostedt@...dmis.org,
	ebiederm@...ssion.com, josh@...htriplett.org,
	David.Laight@...LAB.COM, palves@...hat.com, rmallon@...il.com,
	bfields@...ldses.org
Subject: Re: [PATCH v4] hashtable: introduce a small and naive hashtable

On 09/10/2012 04:48 AM, Mathieu Desnoyers wrote:
> * Sasha Levin (levinsasha928@...il.com) wrote:
>> +#define hash_init(hashtable)							\
>> +({										\
>> +	int __i;								\
>> +										\
>> +	for (__i = 0; __i < HASH_BITS(hashtable); __i++)			\
>> +		INIT_HLIST_HEAD(hashtable + __i);				\
> 
> I suspect that hashtable will be a pointer, and you use the "+" operator
> to do an offset on this pointer. Any thought on using:
> 
>             INIT_HLIST_HEAD(&hashtable[__i]);
> 
> instead ? It would provide the same result, but would ensure that the
> user is indeed passing a pointer, and not an integer.

It also looks nicer :)

> Also, why isn't it a static inline ? I'm probably missing something. If
> there is a reason why it needs to stay a #define, please document it in
> the comment.

It's a define because it needs to get the size of the hashtable.

I'll document that.


Thanks,
Sasha
--
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