* [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t()
@ 2026-03-14 11:01 Anas Iqbal
2026-03-18 4:28 ` kernel test robot
2026-03-24 16:35 ` Mathieu Poirier
0 siblings, 2 replies; 3+ messages in thread
From: Anas Iqbal @ 2026-03-14 11:01 UTC (permalink / raw)
To: andersson, mathieu.poirier; +Cc: linux-remoteproc, linux-kernel, Anas Iqbal
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>
---
drivers/remoteproc/remoteproc_internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
index 0cd09e67ac14..0a5e15744b1d 100644
--- a/drivers/remoteproc/remoteproc_internal.h
+++ b/drivers/remoteproc/remoteproc_internal.h
@@ -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 */
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t()
2026-03-14 11:01 [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t() Anas Iqbal
@ 2026-03-18 4:28 ` kernel test robot
2026-03-24 16:35 ` Mathieu Poirier
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-03-18 4:28 UTC (permalink / raw)
To: Anas Iqbal, andersson, mathieu.poirier
Cc: oe-kbuild-all, linux-remoteproc, linux-kernel, Anas Iqbal
Hi Anas,
kernel test robot noticed the following build warnings:
[auto build test WARNING on remoteproc/rproc-next]
[also build test WARNING on linus/master v7.0-rc4 next-20260317]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Anas-Iqbal/remoteproc-use-SIZE_MAX-in-rproc_u64_fit_in_size_t/20260315-042913
base: https://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git rproc-next
patch link: https://lore.kernel.org/r/20260314110137.178981-1-mohd.abd.6602%40gmail.com
patch subject: [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t()
config: arm64-randconfig-r072-20260317 (https://download.01.org/0day-ci/archive/20260318/202603181241.MTvrVLVa-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9004-gb810ac53
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603181241.MTvrVLVa-lkp@intel.com/
smatch warnings:
drivers/remoteproc/remoteproc_internal.h:221 rproc_u64_fit_in_size_t() warn: always true condition '(val <= (~0)) => (0-u64max <= u64max)'
vim +221 drivers/remoteproc/remoteproc_internal.h
214
215 static inline
216 bool rproc_u64_fit_in_size_t(u64 val)
217 {
218 if (sizeof(size_t) == sizeof(u64))
219 return true;
220
> 221 return val <= SIZE_MAX;
222 }
223
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t()
2026-03-14 11:01 [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t() Anas Iqbal
2026-03-18 4:28 ` kernel test robot
@ 2026-03-24 16:35 ` Mathieu Poirier
1 sibling, 0 replies; 3+ messages in thread
From: Mathieu Poirier @ 2026-03-24 16:35 UTC (permalink / raw)
To: Anas Iqbal; +Cc: andersson, linux-remoteproc, linux-kernel
On Sat, Mar 14, 2026 at 11:01:37AM +0000, Anas Iqbal wrote:
> 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>
> ---
> drivers/remoteproc/remoteproc_internal.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
> index 0cd09e67ac14..0a5e15744b1d 100644
> --- a/drivers/remoteproc/remoteproc_internal.h
> +++ b/drivers/remoteproc/remoteproc_internal.h
> @@ -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;
Applied.
Thanks,
Mathieu
> }
>
> #endif /* REMOTEPROC_INTERNAL_H */
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-24 16:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-14 11:01 [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t() Anas Iqbal
2026-03-18 4:28 ` kernel test robot
2026-03-24 16:35 ` Mathieu Poirier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox