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] [thread-next>] [day] [month] [year] [list]
Message-Id: <1254070336.20648.518.camel@desktop>
Date:	Sun, 27 Sep 2009 09:52:16 -0700
From:	Daniel Walker <dwalker@...o99.com>
To:	Cesar Eduardo Barros <cesarb@...arb.net>
Cc:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Roland Dreier <rolandd@...co.com>
Subject: Re: [PATCH] WARN_ONCE(): use bool for boolean flag

On Sun, 2009-09-27 at 12:56 -0300, Cesar Eduardo Barros wrote:
> Daniel Walker escreveu:
> > On Sun, 2009-09-27 at 10:53 -0300, Cesar Eduardo Barros wrote:
> >>  #define
> >> WARN_ON_ONCE(condition)        ({                              \
> >> -       static int __warned;                                    \
> >> +       static bool __warned;                                   \
> >>         int __ret_warn_once = !!(condition);                    \
> > 
> > Could __ret_warn_once be bool also ? It looks like just another
> > conditional variable..
> 
> Yes, it could (as long as either it is converted back to int in the 
> return of the macro, or all users do not care about the macro's return 
> type). However, the justification used for the printk_once patch (and 
> this WARN_ONCE patch) does not apply directly anymore, since the code is 
> different (to start with, it is not a static variable).

I did a couple kernel builds to test this on a small normal config,

vmlinux.base-line
   text	   data	    bss	    dec	    hex	filename
6718958	 497200	1082460	8298618	 7ea07a	vmlinux.base-line

vmlinux.one-bool <-- Your patch
   text	   data	    bss	    dec	    hex	filename
6718590	 497232	1082292	8298114	 7e9e82	vmlinux.one-bool

vmlinux.all-bool-converted 
   text	   data	    bss	    dec	    hex	filename
6718506	 497232	1082292	8298030	 7e9e2e	vmlinux.all-converted

your changes drops the size 368 bytes, and if you convert the other
conditionals it drops it by another 84 bytes. Not much more, but it's
something.

So I think Rolands original reasoning still holds.. As far as people
needing an int output from WARN_ON() , I'm not sure that's happening
anyplace .. I can't imagine a sane usage for that.. 

Daniel

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