In elfloader.c, starting on line 209 in elf_load, we have the following code:
elf_file->elf_memory = kzalloc(stat.filesize);
res = fread(elf_file->elf_memory, stat.filesize, 1, fd);
if (res < 0)
{
goto out;
}
It is possible that the kzalloc on line 209 could fail, but that is not checked which could result in an issue. It should be changed to:
elf_file->elf_memory = kzalloc(stat.filesize);
if (!elf_file->elf_memory)
{
res = -ENOMEM;
goto out;
}
res = fread(elf_file->elf_memory, stat.filesize, 1, fd);
if (res < 0)
{
goto out;
}