linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: "Kees Cook" <keescook@chromium.org>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Tomer Maimon" <tmaimon77@gmail.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Linux Next Mailing List" <linux-next@vger.kernel.org>
Subject: Re: linux-next: build failure after merge of the kspp tree  (in pinctrl-npcm7xx)
Date: Wed, 16 Mar 2022 13:00:17 +0100	[thread overview]
Message-ID: <YjHRUdXqHHdr/XXL@latitude> (raw)
In-Reply-To: <20220316183227.725bfd37@canb.auug.org.au>

[-- Attachment #1: Type: text/plain, Size: 2911 bytes --]

Hello Stephen, Tomer, and others,


On Wed, Mar 16, 2022 at 06:32:27PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the kspp tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
[...]
> drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c: In function 'npcmgpio_irq_handler':
> include/linux/find.h:40:23: error: array subscript 'long unsigned int[0]' is partly outside array bounds of 'u32[1]' {aka 'unsigned int[1]'} [-Werror=array-bounds]
>    40 |                 val = *addr & GENMASK(size - 1, offset);
>       |                       ^~~~~
> drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:219:13: note: while referencing 'sts'
>   219 |         u32 sts, en, bit;
>       |             ^~~


Quoting the code in pinctrl-npcm7xx:

	for_each_set_bit(bit, (const void *)&sts, NPCM7XX_GPIO_PER_BANK)
		generic_handle_domain_irq(gc->irq.domain, bit);

The cast is indeed already a bit suspicious, because such casts can hide
type mismatch bugs.

The pinctrl-npcm7xx driver probably won't actually *run* on a 64-bit
platform (I guess there will be a separate pinctrl-npcm8xx driver for
the upcoming 64-bit platform from Nuvoton) but it's better not to have
unnecessary 32bit-isms.

> 
> Caused by commit
> 
>   3b588e43ee5c ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver")
> 
> probably exposed by commit
> 
>   a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> 
> from the pinctrl tree and enabling -Werror=array-bounds.
> 
> I have applied the following hack patch for today.
> 
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Wed, 16 Mar 2022 18:12:14 +1100
> Subject: [PATCH] fixup for "pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver"
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
> index 41136f63014a..fddcb7d6bdf4 100644
> --- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
> +++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
> @@ -216,7 +216,8 @@ static void npcmgpio_irq_handler(struct irq_desc *desc)
>  	struct gpio_chip *gc;
>  	struct irq_chip *chip;
>  	struct npcm7xx_gpio *bank;
> -	u32 sts, en, bit;
> +	unsigned long sts, bit;
> +	u32 en;
>  
>  	gc = irq_desc_get_handler_data(desc);
>  	bank = gpiochip_get_data(gc);
> @@ -225,7 +226,7 @@ static void npcmgpio_irq_handler(struct irq_desc *desc)
>  	chained_irq_enter(chip, desc);
>  	sts = ioread32(bank->base + NPCM7XX_GP_N_EVST);
>  	en  = ioread32(bank->base + NPCM7XX_GP_N_EVEN);
> -	dev_dbg(bank->gc.parent, "==> got irq sts %.8x %.8x\n", sts,
> +	dev_dbg(bank->gc.parent, "==> got irq sts %.8lx %.8x\n", sts,
>  		en);

This fix looks reasonable to me.



Thanks,
Jonathan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-03-16 12:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16  7:32 linux-next: build failure after merge of the kspp tree Stephen Rothwell
2022-03-16 12:00 ` Jonathan Neuschäfer [this message]
2022-03-17  1:01 ` Linus Walleij
2022-03-17  8:24   ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YjHRUdXqHHdr/XXL@latitude \
    --to=j.neuschaefer@gmx.net \
    --cc=keescook@chromium.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tmaimon77@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).