From: Anas Iqbal <mohd.abd.6602@gmail.com>
To: andersson@kernel.org, mathieu.poirier@linaro.org
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
Anas Iqbal <mohd.abd.6602@gmail.com>
Subject: [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t()
Date: Sat, 14 Mar 2026 11:01:37 +0000 [thread overview]
Message-ID: <20260314110137.178981-1-mohd.abd.6602@gmail.com> (raw)
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
next reply other threads:[~2026-03-14 11:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-14 11:01 Anas Iqbal [this message]
2026-03-18 4:28 ` [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t() kernel test robot
2026-03-24 16:35 ` Mathieu Poirier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260314110137.178981-1-mohd.abd.6602@gmail.com \
--to=mohd.abd.6602@gmail.com \
--cc=andersson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox