From: Cyan Yang <cyan.yang@sifive.com>
To: opensbi@lists.infradead.org
Subject: [PATCH] lib: utils/irqchip: Add sanity checks to imsic_warm_irqchip_init()
Date: Tue, 9 Apr 2024 22:45:47 +0800 [thread overview]
Message-ID: <20240409144547.87893-1-cyan.yang@sifive.com> (raw)
Add sanity checks for per-HART IMSIC pointer in warm init flow, similar to
what the cold init flow does. This will help prevent any misuse of the
data in scratch space.
Signed-off-by: Cyan Yang <cyan.yang@sifive.com>
---
lib/utils/irqchip/imsic.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/utils/irqchip/imsic.c b/lib/utils/irqchip/imsic.c
index f2a35c6..e6a3657 100644
--- a/lib/utils/irqchip/imsic.c
+++ b/lib/utils/irqchip/imsic.c
@@ -243,10 +243,15 @@ void imsic_local_irqchip_init(void)
int imsic_warm_irqchip_init(void)
{
+ int rc;
struct imsic_data *imsic = imsic_get_data(current_hartid());
/* Sanity checks */
- if (!imsic || !imsic->targets_mmode)
+ rc = imsic_data_check(imsic);
+ if (rc)
+ return rc;
+
+ if (!imsic->targets_mmode)
return SBI_EINVAL;
/* Disable all interrupts */
--
2.39.3 (Apple Git-146)
next reply other threads:[~2024-04-09 14:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 14:45 Cyan Yang [this message]
2024-05-07 12:39 ` [PATCH] lib: utils/irqchip: Add sanity checks to imsic_warm_irqchip_init() Anup Patel
2024-05-08 6:53 ` Cyan Yang
2024-05-14 6:07 ` Anup Patel
2024-05-16 6:54 ` Cyan Yang
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=20240409144547.87893-1-cyan.yang@sifive.com \
--to=cyan.yang@sifive.com \
--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 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).