From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [trace:ftrace/ring-buffer-irq-timestamp 1/7] kernel/trace/trace.c:3356 trace_array_printk() warn: variable dereferenced before check 'tr' (see line 3353)
Date: Mon, 29 Jun 2020 15:50:17 +0800 [thread overview]
Message-ID: <202006291508.yN2Q1iCa%lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3505 bytes --]
CC: kbuild-all(a)lists.01.org
TO: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git ftrace/ring-buffer-irq-timestamp
head: 63afaf390ebc12f578d6bb4ced9ed4a35eab1c92
commit: 0b10b8f570623d0a82ce29089b9be3b3f53e5bf2 [1/7] tracing: Only allow trace_array_printk() to be used by instances
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: x86_64-randconfig-m001-20200629 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
kernel/trace/trace.c:3356 trace_array_printk() warn: variable dereferenced before check 'tr' (see line 3353)
# https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git/commit/?id=0b10b8f570623d0a82ce29089b9be3b3f53e5bf2
git remote add trace https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
git remote update trace
git checkout 0b10b8f570623d0a82ce29089b9be3b3f53e5bf2
vim +/tr +3356 kernel/trace/trace.c
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3341)
26b68dd2f48fe7 Mathieu Malaterre 2018-03-08 3342 __printf(3, 0)
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3343) int trace_array_printk(struct trace_array *tr,
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3344) unsigned long ip, const char *fmt, ...)
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3345) {
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3346) int ret;
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3347) va_list ap;
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3348)
0b10b8f570623d Steven Rostedt (VMware 2020-06-16 3349) /* This is only allowed for created instances */
0b10b8f570623d Steven Rostedt (VMware 2020-06-16 3350) if (tr == &global_trace)
0b10b8f570623d Steven Rostedt (VMware 2020-06-16 3351) return 0;
0b10b8f570623d Steven Rostedt (VMware 2020-06-16 3352)
0b10b8f570623d Steven Rostedt (VMware 2020-06-16 @3353) if (!(tr->trace_flags & TRACE_ITER_PRINTK))
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3354) return 0;
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3355)
953ae45a0c25e0 Divya Indi 2019-08-14 @3356 if (!tr)
953ae45a0c25e0 Divya Indi 2019-08-14 3357 return -ENOENT;
953ae45a0c25e0 Divya Indi 2019-08-14 3358
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3359) va_start(ap, fmt);
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3360) ret = trace_array_vprintk(tr, ip, fmt, ap);
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3361) va_end(ap);
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3362) return ret;
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3363) }
f45d1225adb047 Divya Indi 2019-03-20 3364 EXPORT_SYMBOL_GPL(trace_array_printk);
12883efb670c28 Steven Rostedt (Red Hat 2013-03-05 3365)
:::::: The code at line 3356 was first introduced by commit
:::::: 953ae45a0c25e09428d4a03d7654f97ab8a36647 tracing: Adding NULL checks for trace_array descriptor pointer
:::::: TO: Divya Indi <divya.indi@oracle.com>
:::::: CC: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31959 bytes --]
next reply other threads:[~2020-06-29 7:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 7:50 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-06-29 10:57 [trace:ftrace/ring-buffer-irq-timestamp 1/7] kernel/trace/trace.c:3356 trace_array_printk() warn: variable dereferenced before check 'tr' (see line 3353) Dan Carpenter
2020-06-29 10:57 ` Dan Carpenter
2020-06-29 13:05 ` Steven Rostedt
2020-06-29 13:50 ` Dan Carpenter
2020-06-29 13:50 ` Dan Carpenter
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=202006291508.yN2Q1iCa%lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.