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>] [day] [month] [year] [list]
Date:   Fri, 25 Jun 2021 12:49:56 +0200
From:   Stefan Wahren <stefan.wahren@...e.com>
To:     Jason Wang <wangborong@...rlc.com>,
        "linus.walleij" <linus.walleij@...aro.org>
Cc:     nsaenz <nsaenz@...nel.org>, "f.fainelli" <f.fainelli@...il.com>,
        rjui <rjui@...adcom.com>, sbranden <sbranden@...adcom.com>,
        bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
        phil <phil@...pberrypi.com>, iivanov <iivanov@...e.de>,
        linux-gpio <linux-gpio@...r.kernel.org>,
        linux-rpi-kernel <linux-rpi-kernel@...ts.infradead.org>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] pinctrl: bcm2835: Replace BUG with WARN_ON

Hi,

Am 25.06.21 um 01:51 schrieb Jason Wang:
> The if condition followed by BUG can be replaced to WARN_ON which is
> more compact and formal in linux source.
>
> Signed-off-by: Jason Wang <wangborong@...rlc.com>
> ---
>
> Changes in v2:
>  Accept Florian's advice to replace the BUG_ON() with a WARN_ON().
>
>  drivers/pinctrl/bcm/pinctrl-bcm2835.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
> index 2c87af1180c4..8440c722f6f8 100644
> --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
> +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
> @@ -416,8 +416,7 @@ static void bcm2835_gpio_irq_handler(struct irq_desc *desc)
>  		}
>  	}
>  	/* This should not happen, every IRQ has a bank */
> -	if (i == BCM2835_NUM_IRQS)
> -		BUG();
> +	WARN_ON(i == BCM2835_NUM_IRQS);

whenever this should happen, the source of this interrupt cannot be
determined and acked. So it's very likely that we end up in some kind of
interrupt storm. So i suggest to use at least WARN_ON_ONCE().

Even worse the value of variable "group" is uninitialized in this case,
so maybe we better return immediately after that.

Regards

>  
>  	chained_irq_enter(host_chip, desc);
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ