Currently our wrapper init_module() will happily return success whenever
libkmod fails. While such failures are unlikely, our wrapper should also
fail. In part so it doesn't mask a potentially deeper problem and in
part because the kmod API used, will set errno... Something a normal
syscall wouldn't do AFAICT.
v2:
- remove the respective comment
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/346
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
elf = kmod_elf_new(mem, len);
if (elf == NULL)
- return 0;
+ return -1;
err = kmod_elf_get_section(elf, ".gnu.linkonce.this_module", &off, &bufsize);
buf = (const char *)kmod_elf_get_memory(elf) + off;
kmod_elf_unref(elf);
- /* We couldn't parse the ELF file. Just exit as if it was successful */
if (err < 0)
- return 0;
+ return -1;
/* We need to open both 32 and 64 bits module - hack! */
class = elf_identify(mem);