strncmp would only make sense if it were taking the size of buf as argument, but it's taking the size of ELFMAG instead, which is a fixed 4 bytes. It's thus effectively equal to memcmp, so switch to using that instead.
Signed-off-by: Ahmad Fatoum <[email protected]> --- common/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/elf.c b/common/elf.c index e8126c9b64e7..18c541bf827e 100644 --- a/common/elf.c +++ b/common/elf.c @@ -201,7 +201,7 @@ static int load_elf_image_segments(struct elf_image *elf) static int elf_check_image(struct elf_image *elf, void *buf) { - if (strncmp(buf, ELFMAG, SELFMAG)) { + if (memcmp(buf, ELFMAG, SELFMAG)) { pr_err("ELF magic not found.\n"); return -EINVAL; } -- 2.47.3
