mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Yinan Liu <yinan@linux.alibaba.com>,
	Nathan Chancellor <nathan@kernel.org>
Subject: [GIT PULL] tracing/scripts: Fix some initialization problems
Date: Tue, 18 Jan 2022 18:17:09 -0500	[thread overview]
Message-ID: <20220118181709.5489df67@gandalf.local.home> (raw)

Yinan Liu <yinan@linux.alibaba.com>

Linus,

tracing/scripts: Possible uninitialized variable

The 0day bot discovered a possible uninitialized path in the
scripts that sort the mcount sections at build time. Just needed
to initialize that variable.


Please pull the latest trace-v5.17-2 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.17-2

Tag SHA1: f6512a8d14cbc7d3a9cb63c872fbbabe26399a5a
Head SHA1: 35140d399db2b67153fc53b51a97ddb8ba3b5956


Yinan Liu (1):
      script/sorttable: Fix some initialization problems

----
 scripts/sorttable.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---------------------------
commit 35140d399db2b67153fc53b51a97ddb8ba3b5956
Author: Yinan Liu <yinan@linux.alibaba.com>
Date:   Tue Jan 18 14:52:41 2022 +0800

    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>

diff --git a/scripts/sorttable.h b/scripts/sorttable.h
index 1e8b77928fa4..deb7c1d3e979 100644
--- a/scripts/sorttable.h
+++ b/scripts/sorttable.h
@@ -199,6 +199,8 @@ static int compare_extable(const void *a, const void *b)
 	return 0;
 }
 #ifdef MCOUNT_SORT_ENABLED
+pthread_t mcount_sort_thread;
+
 struct elf_mcount_loc {
 	Elf_Ehdr *ehdr;
 	Elf_Shdr *init_data_sec;
@@ -282,10 +284,9 @@ static int do_sort(Elf_Ehdr *ehdr,
 	unsigned int shnum;
 	unsigned int shstrndx;
 #ifdef MCOUNT_SORT_ENABLED
-	struct elf_mcount_loc mstruct;
+	struct elf_mcount_loc mstruct = {0};
 	uint_t _start_mcount_loc = 0;
 	uint_t _stop_mcount_loc = 0;
-	pthread_t mcount_sort_thread;
 #endif
 #if defined(SORTTABLE_64) && defined(UNWINDER_ORC_ENABLED)
 	unsigned int orc_ip_size = 0;

             reply	other threads:[~2022-01-18 23:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 23:17 Steven Rostedt [this message]
2022-01-19  9:48 ` pr-tracker-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220118181709.5489df67@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nathan@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=yinan@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®