kernel/trace/trace.c:3356 trace_array_printk() warn: variable dereferenced before check 'tr' (see line 3353)
PATCH 1/7 kernel/trace/trace.c:3356 trace_array_printk() warn: variable dereferenced before check 'tr' (see line 3353)
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 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
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 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))
^^^^^^^^^^^^^^^Dereference.
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)
^^^Checked too late.
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) }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 6 lines · On Mon, 29 Jun 2020 13:57:10 +0300 Dan Carpenter <[email protected]>…
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 config: x86_64-randconfig-m001-20200629 (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
Quoted 6 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>smatch warnings:
kernel/trace/trace.c:3356trace_array_printk()warn: variable dereferenced before check 'tr' (see line 3353)
Thanks for the report.
As this is not in a upstream tree yet (it's only in my development branch) and I'm going to fold the fix into the original commit. It doesn't make sense to add a "Reported-by" because the issue that was reported got fixed and folded, Reported-by is for issues that the patch fixes not issues for the patch itself.
Should I just put in a "Reviewed-by: kernel test robot <[email protected]>" and "Reviewed-by: Dan Carpenter <[email protected]>" ?
-- Steve
Quoted 7 lines
# 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 checkout0b10b8f570623d0a82ce29089b9be3b3f53e5bf2
vim +/tr +3356kernel/trace/trace.c
Quoted 18 lines · Steven Rostedt
Quoted 6 lines · On Mon, 29 Jun 2020 13:57:10 +0300 Dan Carpenter <[email protected]>…
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 config: x86_64-randconfig-m001-20200629 (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0Quoted 6 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>smatch warnings:
kernel/trace/trace.c:3356trace_array_printk()warn: variable dereferenced before check 'tr' (see line 3353)Thanks for the report.
Quoted 8 lines
As this is not in a upstream tree yet (it's only in my development branch) and I'm going to fold the fix into the original commit. It doesn't make sense to add a "Reported-by" because the issue that was reported got fixed and folded, Reported-by is for issues that the patch fixes not issues for the patch itself.
Should I just put in a "Reviewed-by: kernel test robot <[email protected]>" and "Reviewed-by: Dan Carpenter <[email protected]>" ?
Nah... Forget about it. These are just a template email that kbuild sends and I forward it. Just ignore it when it doesn't make sense.
regards,
dan carpenter