diff options
author | Clément Léger <cleger@rivosinc.com> | 2024-03-20 15:50:43 +0100 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2024-04-10 09:33:58 +0530 |
commit | 68bc031a76f09e730b29dbc02d832605b4aab219 (patch) | |
tree | 6d5d0e0d0b14520e7456bd9d68346f6a08506af4 | |
parent | a7c5c2cbd27af430e80d894944c479e5e4df71b3 (diff) | |
download | opensbi-68bc031a76f09e730b29dbc02d832605b4aab219.zip opensbi-68bc031a76f09e730b29dbc02d832605b4aab219.tar.gz opensbi-68bc031a76f09e730b29dbc02d832605b4aab219.tar.bz2 |
lib: sbi: Add missing sscrind and sscfg extensions in sbi_hart_ext[]
The sbi_hart_ext[] array is missing these two extensions ids. It is
expected that this array contains all the extensions declaration at the
same index of the SBI_HART_EXT_* define. Without this, when adding a new
extension, there is a mismatch between ids and extension names and it
can even display corrupted extension names.
Addresses-Coverity-ID: 1584994 Out-of-bounds read
Fixes: 6bb6b61c27eb ("lib: sbi: Add support for smcsrind and smcdeleg")
Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
-rw-r--r-- | lib/sbi/sbi_hart.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 3d13694..0e7b5d1 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -666,8 +666,13 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = { __SBI_HART_EXT_DATA(sdtrig, SBI_HART_EXT_SDTRIG), __SBI_HART_EXT_DATA(smcsrind, SBI_HART_EXT_SMCSRIND), __SBI_HART_EXT_DATA(smcdeleg, SBI_HART_EXT_SMCDELEG), + __SBI_HART_EXT_DATA(sscsrind, SBI_HART_EXT_SSCSRIND), + __SBI_HART_EXT_DATA(ssccfg, SBI_HART_EXT_SSCCFG), }; +_Static_assert(SBI_HART_EXT_MAX == array_size(sbi_hart_ext), + "sbi_hart_ext[]: wrong number of entries"); + /** * Get the hart extensions in string format * |