Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

script/sorttable: Fix some initialization problems

elf_mcount_loc and mcount_sort_thread definitions are not
initialized immediately within the function, which can cause
the judgment logic to use uninitialized values when the
initialization logic of subsequent code fails.

Link: https://lkml.kernel.org/r/20211212113358.34208-2-yinan@linux.alibaba.com
Link: https://lkml.kernel.org/r/20220118065241.42364-1-yinan@linux.alibaba.com

Fixes: 72b3942a173c ("scripts: ftrace - move the sort-processing in ftrace_init")
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Yinan Liu <yinan@linux.alibaba.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Yinan Liu and committed by
Steven Rostedt
35140d39 f37c3bbc

+3 -2
+3 -2
scripts/sorttable.h
··· 199 199 return 0; 200 200 } 201 201 #ifdef MCOUNT_SORT_ENABLED 202 + pthread_t mcount_sort_thread; 203 + 202 204 struct elf_mcount_loc { 203 205 Elf_Ehdr *ehdr; 204 206 Elf_Shdr *init_data_sec; ··· 284 282 unsigned int shnum; 285 283 unsigned int shstrndx; 286 284 #ifdef MCOUNT_SORT_ENABLED 287 - struct elf_mcount_loc mstruct; 285 + struct elf_mcount_loc mstruct = {0}; 288 286 uint_t _start_mcount_loc = 0; 289 287 uint_t _stop_mcount_loc = 0; 290 - pthread_t mcount_sort_thread; 291 288 #endif 292 289 #if defined(SORTTABLE_64) && defined(UNWINDER_ORC_ENABLED) 293 290 unsigned int orc_ip_size = 0;