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]
Message-ID: <s5hip544oaf.wl%tiwai@suse.de>
Date:	Wed, 06 Mar 2013 15:04:56 +0100
From:	Takashi Iwai <tiwai@...e.de>
To:	David Henningsson <david.henningsson@...onical.com>
Cc:	Christine Spang <christine.spang@...cle.com>,
	Sasha Levin <sasha.levin@...cle.com>,
	alsa-devel@...a-project.org, Jamie Iles <jamie.iles@...cle.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [alsa-devel] [PATCH] Make snd_BUG_ON() always evaluate and return the conditional expression.

At Wed, 06 Mar 2013 14:49:28 +0100,
David Henningsson wrote:
> 
> 2013-03-05 21:41, Christine Spang skrev:
> > On 03/05/2013 04:05 AM, Takashi Iwai wrote:
> >> At Mon,  4 Mar 2013 17:02:59 -0500,
> >> Christine Spang wrote:
> >>> Having snd_BUG_ON() only evaluate its conditional when CONFIG_SND_DEBUG
> >>> is set leads to frequent bugs, since other similar macros in the kernel
> >>> have different behavior. Let's make snd_BUG_ON() act like those macros
> >>> so it will stop being accidentally misused.
> >>>
> >>> Signed-off-by: Christine Spang <christine.spang@...cle.com>
> >> Sounds reasonable.  The dependency on CONFIG_SND_DEBUG was for
> >> allowing more optimization, but since we use this for more places than
> >> expected, this change would be safer indeed.
> >>
> >> If no one has objection, I'll apply it for 3.10 kernel.
> 
> If snd_BUG_ON now works like WARN_ON rather than BUG_ON (at least it 
> does with this change, if I understand things right),

No, snd_BUG_ON() has always been equivalent with WARN_ON() when
CONFIG_SND_DEBUG is set.  But it's empty when CONFIG_SND_DEBUG=n
(i.e. the conditional is ignored).

Christine's patch changes the behavior in only the latter case.  It
enables the conditional but doesn't involve WARN_ON(), so the check is
done silently.

> maybe we should 
> rename it to snd_WARN_ON for consistency?

Maybe.  As an additional note, BUG_ON() should be almost never used in
the normal driver codes. If you find BUG_ON() in a driver code, doubt
it twice whether it's right.


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