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:	Fri, 19 Jun 2015 11:32:03 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Maninder Singh <maninder1.s@...sung.com>
cc:	Jason Cooper <jason@...edaemon.net>,
	LKML <linux-kernel@...r.kernel.org>, pankaj.m@...sung.com,
	Marc Zyngier <marc.zyngier@....com>
Subject: Re: [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG

On Fri, 19 Jun 2015, Maninder Singh wrote:

> Use BUG_ON(condition) instead of if(condition)/BUG()
> As given in scripts/coccinelle/misc/bugon.cocci
> 
> Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
> Reviewed-by: Vaneet Narang <v.narang@...sung.com>
> ---
>  drivers/irqchip/irq-gic.c |   18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> index 8d7e1c8..b222c7b 100644
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -329,8 +329,7 @@ static struct irq_chip gic_chip = {
>  
>  void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)
>  {
> -	if (gic_nr >= MAX_GIC_NR)
> -		BUG();
> +	BUG_ON(gic_nr >= MAX_GIC_NR);
>  	if (irq_set_handler_data(irq, &gic_data[gic_nr]) != 0)
>  		BUG();

So this patch was clearly done just by running a script and not sanity
checked afterwards. Otherwise the next if() BUG(); construct would
have been fixed as well.

Further, while we are at that. It would be even more useful to analyze
whether the BUG_ON() is needed in the first place or at least could be
made conditional on some debug option.

But that's not done by the script either, right?

Thanks,

	tglx

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