* [PATCH] remoteproc: elf_loader: redundant check remove
@ 2024-10-14 5:48 anish kumar
2024-10-14 23:36 ` Bjorn Andersson
0 siblings, 1 reply; 2+ messages in thread
From: anish kumar @ 2024-10-14 5:48 UTC (permalink / raw)
To: andersson, mathieu.poirier; +Cc: linux-remoteproc, linux-kernel, anish kumar
offset will always be positive number and adding
and comparing to the same variable 'size' will
always result in check being false always.
Remove this superfluous check.
Signed-off-by: anish kumar <yesanishhere@gmail.com>
---
drivers/remoteproc/remoteproc_elf_loader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c
index 94177e416047..c6d893e9c15e 100644
--- a/drivers/remoteproc/remoteproc_elf_loader.c
+++ b/drivers/remoteproc/remoteproc_elf_loader.c
@@ -278,7 +278,7 @@ find_table(struct device *dev, const struct firmware *fw)
table = (struct resource_table *)(elf_data + offset);
/* make sure we have the entire table */
- if (offset + size > fw_size || offset + size < size) {
+ if (offset + size > fw_size) {
dev_err(dev, "resource table truncated\n");
return NULL;
}
--
2.39.3 (Apple Git-146)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] remoteproc: elf_loader: redundant check remove
2024-10-14 5:48 [PATCH] remoteproc: elf_loader: redundant check remove anish kumar
@ 2024-10-14 23:36 ` Bjorn Andersson
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2024-10-14 23:36 UTC (permalink / raw)
To: anish kumar; +Cc: mathieu.poirier, linux-remoteproc, linux-kernel
On Sun, Oct 13, 2024 at 10:48:20PM GMT, anish kumar wrote:
> offset will always be positive number and adding
> and comparing to the same variable 'size' will
> always result in check being false always.
> Remove this superfluous check.
>
What if offset + size overflows?
Regards,
Bjorn
> Signed-off-by: anish kumar <yesanishhere@gmail.com>
> ---
> drivers/remoteproc/remoteproc_elf_loader.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c
> index 94177e416047..c6d893e9c15e 100644
> --- a/drivers/remoteproc/remoteproc_elf_loader.c
> +++ b/drivers/remoteproc/remoteproc_elf_loader.c
> @@ -278,7 +278,7 @@ find_table(struct device *dev, const struct firmware *fw)
> table = (struct resource_table *)(elf_data + offset);
>
> /* make sure we have the entire table */
> - if (offset + size > fw_size || offset + size < size) {
> + if (offset + size > fw_size) {
> dev_err(dev, "resource table truncated\n");
> return NULL;
> }
> --
> 2.39.3 (Apple Git-146)
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-14 23:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14 5:48 [PATCH] remoteproc: elf_loader: redundant check remove anish kumar
2024-10-14 23:36 ` Bjorn Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox