remoteproc: elf_loader: redundant check remove
PATCH 1/1 remoteproc: elf_loader: redundant check remove
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 <[email protected]>
--- drivers/remoteproc/remoteproc_elf_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/remoteproc_elf_loader.c +1 -1
@@ -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 ; }
Signature · 1 line
2.39.3 (Apple Git-146)
Bjorn Andersson
maintainerQuoted 5 lines · 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.
What if offset + size overflows?
Regards,
Bjorn
Quoted 21 lines
Signed-off-by anish kumar <[email protected]>--- drivers/remoteproc/remoteproc_elf_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/remoteproc/remoteproc_elf_loader.c +1
-1@@ -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 ; }Signature · 1 line
2.39.3 (Apple Git-146)