From 22ff75099c53a4bac72abc3fa10157aabeb3ce49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= Date: Tue, 9 Apr 2024 12:02:04 +0200 Subject: [PATCH] lib: sbi: sse: simplify 32bits overflow check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reported-by: Samuel Holland Reviewed-by: Anup Patel --- lib/sbi/sbi_sse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sbi/sbi_sse.c b/lib/sbi/sbi_sse.c index 0f8b3476..1b6048d8 100644 --- a/lib/sbi/sbi_sse.c +++ b/lib/sbi/sbi_sse.c @@ -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; }