forked from Mirrors/opensbi
lib: sbi: sse: simplify 32bits overflow check
Rather than checking 32bits overflow with some absolute value, check the value to be different from the cast itself. Signed-off-by: Clément Léger <cleger@rivosinc.com> Reported-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
7aa80ea495
commit
22ff75099c
@@ -344,7 +344,7 @@ static int sse_event_set_attr_check(struct sbi_sse_event *e, uint32_t attr_id,
|
|||||||
break;
|
break;
|
||||||
case SBI_SSE_ATTR_PRIO:
|
case SBI_SSE_ATTR_PRIO:
|
||||||
#if __riscv_xlen > 32
|
#if __riscv_xlen > 32
|
||||||
if (val > 0xFFFFFFFFUL) {
|
if (val != (uint32_t)val) {
|
||||||
ret = SBI_EINVAL;
|
ret = SBI_EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user