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:
Clément Léger
2024-04-09 12:02:04 +02:00
committed by Anup Patel
parent 7aa80ea495
commit 22ff75099c

View File

@@ -344,7 +344,7 @@ static int sse_event_set_attr_check(struct sbi_sse_event *e, uint32_t attr_id,
break;
case SBI_SSE_ATTR_PRIO:
#if __riscv_xlen > 32
if (val > 0xFFFFFFFFUL) {
if (val != (uint32_t)val) {
ret = SBI_EINVAL;
break;
}