Skip to content

Commit

Permalink
llext: fix minor Coverity issue #434586 (again)
Browse files Browse the repository at this point in the history
The check combination of "is zero" and then "less than zero" leaves open
the theoretical possibility of a positive return value, which would
continue on with an uinitialized 'sym'.

Checking for "not zero" has the same effect and covers all situations.

Commit 56fd854 did the same thing for 'rela' a few lines above, but
missed this instance. No other places in the llext code have this issue.

Signed-off-by: Luca Burelli <[email protected]>
  • Loading branch information
pillo79 committed Jan 9, 2025
1 parent d78952b commit 7fd77ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/llext/llext_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static void llext_link_plt(struct llext_loader *ldr, struct llext *ext, elf_shdr
ret = llext_read(ldr, &sym, sizeof(sym));
}

if (ret < 0) {
if (ret != 0) {
LOG_ERR("PLT: failed to read symbol table #%u RELA #%u, trying to continue",
j, i);
continue;
Expand Down

0 comments on commit 7fd77ff

Please sign in to comment.