All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: opensbi@lists.infradead.org
Subject: [PATCH v3 1/5] lib: utils/irqchip: plic: Fix the off-by-one error in priority save/restore helpers
Date: Sun, 11 Dec 2022 11:07:01 +0100	[thread overview]
Message-ID: <87a63ufe4a.fsf@linux-m68k.org> (raw)
In-Reply-To: <20221211065424.806478-1-bmeng@tinylab.org> (Bin Meng's message of "Sun, 11 Dec 2022 14:54:20 +0800")

On Dez 11 2022, Bin Meng wrote:

> diff --git a/lib/utils/irqchip/plic.c b/lib/utils/irqchip/plic.c
> index 73d7788..4df9020 100644
> --- a/lib/utils/irqchip/plic.c
> +++ b/lib/utils/irqchip/plic.c
> @@ -38,13 +38,13 @@ static void plic_set_priority(const struct plic_data *plic, u32 source, u32 val)
>  
>  void plic_priority_save(const struct plic_data *plic, u8 *priority)
>  {
> -	for (u32 i = 0; i < plic->num_src; i++)
> +	for (u32 i = 1; i <= plic->num_src; i++)
>  		priority[i] = plic_get_priority(plic, i);

That needs to adjust the index into the priority array.

>  void plic_priority_restore(const struct plic_data *plic, const u8 *priority)
>  {
> -	for (u32 i = 0; i < plic->num_src; i++)
> +	for (u32 i = 1; i <= plic->num_src; i++)
>  		plic_set_priority(plic, i, priority[i]);

Likewise.

-- 
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


  parent reply	other threads:[~2022-12-11 10:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-11  6:54 [PATCH v3 1/5] lib: utils/irqchip: plic: Fix the off-by-one error in priority save/restore helpers Bin Meng
2022-12-11  6:54 ` [PATCH v3 2/5] lib: utils/irqchip: plic: Ensure no out-of-bound access " Bin Meng
2022-12-11 12:03   ` Anup Patel
2022-12-11 12:11   ` Andreas Schwab
2022-12-12  6:45     ` Samuel Holland
2022-12-12  7:04   ` Samuel Holland
2022-12-17  3:27     ` Anup Patel
2022-12-17  3:40   ` Anup Patel
2022-12-11  6:54 ` [PATCH v3 3/5] lib: utils/irqchip: plic: Fix the off-by-one error in plic_context_init() Bin Meng
2022-12-12  6:49   ` Samuel Holland
2022-12-17  3:40   ` Anup Patel
2022-12-11  6:54 ` [PATCH v3 4/5] lib: utils/irqchip: plic: Fix the off-by-one error in context save/restore helpers Bin Meng
2022-12-12  6:57   ` Samuel Holland
2022-12-17  3:40   ` Anup Patel
2022-12-11  6:54 ` [PATCH v3 5/5] lib: utils/irqchip: plic: Ensure no out-of-bound access " Bin Meng
2022-12-11 12:06   ` Anup Patel
2022-12-12  7:00   ` Samuel Holland
2022-12-17  3:39     ` Anup Patel
2022-12-17  3:41   ` Anup Patel
2022-12-11 10:07 ` Andreas Schwab [this message]
2022-12-11 10:18   ` [PATCH v3 1/5] lib: utils/irqchip: plic: Fix the off-by-one error in priority " Bin Meng
2022-12-11 10:52     ` Andreas Schwab
2022-12-11 12:11     ` Andreas Schwab
2022-12-12  6:40     ` Samuel Holland
2022-12-17  3:21       ` Anup Patel
2022-12-17 12:50         ` Andreas Schwab
2022-12-17  3:40 ` Anup Patel

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=87a63ufe4a.fsf@linux-m68k.org \
    --to=schwab@linux-m68k.org \
    --cc=opensbi@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.