diff options
| author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-09-27 16:14:51 +0200 |
|---|---|---|
| committer | Anup Patel <anup@brainfault.org> | 2023-10-06 17:06:09 +0530 |
| commit | 8197c2f1ec5bcdd3aa7477efef59e9ebd57ee331 (patch) | |
| tree | ed72f26c9e30da7379b1d8e976931045c61ffd9b /lib | |
| parent | d36709fcafe2d39c3d999489a8ca836b138e4f04 (diff) | |
| download | opensbi-8197c2f1ec5bcdd3aa7477efef59e9ebd57ee331.zip opensbi-8197c2f1ec5bcdd3aa7477efef59e9ebd57ee331.tar.gz opensbi-8197c2f1ec5bcdd3aa7477efef59e9ebd57ee331.tar.bz2 | |
lib: sbi: fix sbi_domain_get_assigned_hartmask()
'1' is a 32 bit integer. When shifting it by more than 31 bits it becomes
zero and we get an incorrect return value.
Addresses-Coverity-ID: 1568356 Bad bit shift operation
Fixes: 296e70d69da7 ("lib: sbi: Extend sbi_hartmask to support both hartid and hartindex")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sbi/sbi_domain.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index b1f485d..fd4a296 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -76,7 +76,7 @@ ulong sbi_domain_get_assigned_hartmask(const struct sbi_domain *dom, ulong ret = 0; for (int i = 0; i < 8 * sizeof(ret); i++) { if (sbi_domain_is_assigned_hart(dom, hbase + i)) - ret |= 1 << i; + ret |= 1UL << i; } return ret; |
