Skip to content

Commit 943cfbc

Browse files
iqbalcodes6602mathieupoirier
authored andcommitted
remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t()
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>
1 parent 46fcbca commit 943cfbc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/remoteproc/remoteproc_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ bool rproc_u64_fit_in_size_t(u64 val)
218218
if (sizeof(size_t) == sizeof(u64))
219219
return true;
220220

221-
return (val <= (size_t) -1);
221+
return val <= SIZE_MAX;
222222
}
223223

224224
#endif /* REMOTEPROC_INTERNAL_H */

0 commit comments

Comments
 (0)