Commit 9f71fbcd authored by Michal Kubecek's avatar Michal Kubecek Committed by Peter Zijlstra

objtool: initialize all of struct elf

Function elf_open_read() only zero initializes the initial part of
allocated struct elf; num_relocs member was recently added outside the
zeroed part so that it was left uninitialized, resulting in build failures
on some systems.

The partial initialization is a relic of times when struct elf had large
hash tables embedded. This is no longer the case so remove the trap and
initialize the whole structure instead.

Fixes: eb0481bb ("objtool: Fix reloc_hash size")
Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/20230629102051.42E8360467@lion.mk-sys.cz
parent 06c2afb8
......@@ -1005,7 +1005,7 @@ struct elf *elf_open_read(const char *name, int flags)
perror("malloc");
return NULL;
}
memset(elf, 0, offsetof(struct elf, sections));
memset(elf, 0, sizeof(*elf));
INIT_LIST_HEAD(&elf->sections);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment