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: <ZLgTwiTzykDhCd5w@smile.fi.intel.com>
Date:   Wed, 19 Jul 2023 19:48:02 +0300
From:   Andy Shevchenko <andy@...nel.org>
To:     Samuel Holland <samuel.holland@...ive.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Emil Renner Berthing <emil.renner.berthing@...onical.com>,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v2 2/4] gpio: sifive: Look up IRQs only once during probe

On Wed, Jul 19, 2023 at 09:34:43AM -0700, Samuel Holland wrote:
> of_irq_count(), or eqivalently platform_irq_count(), simply looks up
> successively-numbered IRQs until that fails. Since this driver needs to
> look up each IRQ anyway to get its virq number, use that existing loop
> to count the IRQs at the same time.

...

> -	ngpio = of_irq_count(node);
> -	if (ngpio > SIFIVE_GPIO_MAX) {
> -		dev_err(dev, "Too many GPIO interrupts (max=%d)\n",
> -			SIFIVE_GPIO_MAX);
> -		return -ENXIO;

Do we still need this check?

> -	}

...

> +	for (ngpio = 0; ngpio < SIFIVE_GPIO_MAX; ngpio++) {
> +		ret = platform_get_irq_optional(pdev, ngpio);
>  		if (ret < 0)
> -			return ret;
> -		chip->irq_number[i] = ret;
> +			break;
> +		chip->irq_number[ngpio] = ret;
>  	}

If so, here we need something like

	ret = platform_get_irq_optional(pdev, ngpio);
	if (ret > 0) {
		dev_err(dev, "Too many GPIO interrupts (max=%d)\n",
			SIFIVE_GPIO_MAX);
		return -ENXIO;
	}

Otherwise you need to mention this relaxation in the commit message.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ