diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2024-04-08 09:29:04 +0200 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2024-04-10 09:38:24 +0530 |
commit | 37e1544a86135c8048af77a51486397209529fff (patch) | |
tree | 7ac235641bb8b1a4ad219bf140dc6325316ad611 | |
parent | 68bc031a76f09e730b29dbc02d832605b4aab219 (diff) | |
download | opensbi-37e1544a86135c8048af77a51486397209529fff.zip opensbi-37e1544a86135c8048af77a51486397209529fff.tar.gz opensbi-37e1544a86135c8048af77a51486397209529fff.tar.bz2 |
lib: sbi: sse_event_get() may return NULL
sse_event_get() may return NULL. We should not dereference the return value
in sbi_sse_exit() without checking.
Fixes: c8cdf01d8f3a ("lib: sbi: Add support for Supervisor Software Events extension")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
-rw-r--r-- | lib/sbi/sbi_sse.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sbi/sbi_sse.c b/lib/sbi/sbi_sse.c index a686692..f0729f9 100644 --- a/lib/sbi/sbi_sse.c +++ b/lib/sbi/sbi_sse.c @@ -1119,7 +1119,7 @@ void sbi_sse_exit(struct sbi_scratch *scratch) for (i = 0; i < EVENT_COUNT; i++) { e = sse_event_get(supported_events[i]); - if (e->attrs.hartid != current_hartid()) + if (!e || e->attrs.hartid != current_hartid()) continue; if (sse_event_state(e) > SBI_SSE_STATE_REGISTERED) { |