]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t()
authorAnas Iqbal <mohd.abd.6602@gmail.com>
Sat, 14 Mar 2026 11:01:37 +0000 (11:01 +0000)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Tue, 24 Mar 2026 16:33:29 +0000 (10:33 -0600)
Smatch reports:

drivers/remoteproc/remoteproc_elf_loader.c:221
warn: always true condition '(val <= -1)'

The helper function rproc_u64_fit_in_size_t() compares the value
against (size_t)-1, which is equivalent to SIZE_MAX but can confuse
static analysis tools and lead to the above warning.

Replace (size_t)-1 with SIZE_MAX to make the intent explicit and
avoid the Smatch warning without changing the behavior.

Signed-off-by: Anas Iqbal <mohd.abd.6602@gmail.com>
Link: https://lore.kernel.org/r/20260314110137.178981-1-mohd.abd.6602@gmail.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
drivers/remoteproc/remoteproc_internal.h

index 0cd09e67ac14520d9d93db1547e5f16299680d33..0a5e15744b1d988653698677e4e4e21cc4c75bf0 100644 (file)
@@ -218,7 +218,7 @@ bool rproc_u64_fit_in_size_t(u64 val)
        if (sizeof(size_t) == sizeof(u64))
                return true;
 
-       return (val <= (size_t) -1);
+       return val <= SIZE_MAX;
 }
 
 #endif /* REMOTEPROC_INTERNAL_H */