llext: fix minor Coverity issue #434586

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 'rela'.

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

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
Luca Burelli 2024-11-26 10:26:30 +01:00 committed by Benjamin Cabé
commit 56fd854423

View file

@ -168,7 +168,7 @@ static void llext_link_plt(struct llext_loader *ldr, struct llext *ext, elf_shdr
ret = llext_read(ldr, &rela, sizeof(rela));
}
if (ret < 0) {
if (ret != 0) {
LOG_ERR("PLT: failed to read RELA #%u, trying to continue", i);
continue;
}