Skip to content

Commit 2ea77fc

Browse files
Hugh Dickinsnathanchance
authored andcommitted
modpost: Initialize builtin_modname to stop SIGSEGVs
Segmentation fault ./scripts/mod/modpost -o vmlinux.symvers vmlinux.o stops the kernel build. It comes when write_vmlinux_export_c_file() tries to buf_printf alias->builtin_modname. malloc'ed memory is not necessarily zeroed. NULL new->builtin_modname before adding to aliases. Fixes: 5ab23c7 ("modpost: Create modalias for builtin modules") Signed-off-by: Hugh Dickins <hughd@google.com> Reviewed-by: Nicolas Schier <nsc@kernel.org> Link: https://patch.msgid.link/4590a243-0a7e-b7e6-e2d3-cd1b41a12237@google.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent 37fac07 commit 2ea77fc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

scripts/mod/file2alias.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ module_alias_printf(struct module *mod, bool append_wildcard,
9494
}
9595
}
9696

97+
new->builtin_modname = NULL;
9798
list_add_tail(&new->node, &mod->aliases);
9899
}
99100

0 commit comments

Comments
 (0)