Message ID | 20241014054820.59860-1-yesanishhere@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | remoteproc: elf_loader: redundant check remove | expand |
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) >
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; }
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(-)