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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 04 Nov 2007 22:23:10 +0100 From: Eric Dumazet <dada1@...mosbay.com> To: Jarek Poplawski <jarkao2@...pl> CC: David Miller <davem@...emloft.net>, ak@...e.de, netdev@...r.kernel.org, acme@...hat.com Subject: Re: [PATCH] INET : removes per bucket rwlock in tcp/dccp ehash table Jarek Poplawski a écrit : > Jarek Poplawski wrote, On 11/04/2007 06:58 PM: > >> Eric Dumazet wrote, On 11/04/2007 12:31 PM: > > ... > >>> +static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo) >>> +{ > > ... > >>> + if (sizeof(rwlock_t) != 0) { > > ... > >>> + for (i = 0; i < size; i++) >>> + rwlock_init(&hashinfo->ehash_locks[i]); >> >> This looks better now, but still is doubtful to me: even if it's safe with >> current rwlock implementation, can't we imagine some new debugging or >> statistical code added, which would be called from rwlock_init() without >> using rwlock_t structure? IMHO, if read_lock() etc. are called in such a >> case, rwlock_init() should be done as well. > > > Of course I mean: if sizeof(rwlock_t) == 0. Given those two choices : #if defined(CONFIG_SMP) || defined(CONFIG_PROVE__LOCKING) kmalloc(sizeof(rwlock_t) * size); #endif and if (sizeof(rwlock_t) != 0) { kmalloc(sizeof(rwlock_t) * size); } I prefer the 2nd one. Less error prone, and no need to remember how are spelled the gazillions CONFIG_something we have. - 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