LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [kbuild] [trace:ftrace/core 35/39] kernel/trace/trace_boot.c:420 trace_boot_init_histograms() warn: curly braces intended?
@ 2021-08-31 18:45 Dan Carpenter
2021-09-01 2:07 ` Masami Hiramatsu
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-08-31 18:45 UTC (permalink / raw)
To: kbuild, Masami Hiramatsu
Cc: lkp, kbuild-all, linux-kernel, Steven Rostedt (VMware)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git ftrace/core
head: 3dc65994e3c1c999be3d991cdc96705e167cb3b1
commit: 5d4648a0415efc239ffb377bce1d389723eda25d [35/39] tracing/boot: Show correct histogram error command
config: x86_64-randconfig-m001-20210831 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 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_boot.c:420 trace_boot_init_histograms() warn: curly braces intended?
kernel/trace/trace_boot.c:421 trace_boot_init_histograms() error: uninitialized symbol 'tmp'.
kernel/trace/trace_boot.c:421 trace_boot_init_histograms() warn: passing freed memory 'tmp'
kernel/trace/trace_boot.c:422 trace_boot_init_histograms() error: double free of 'tmp'
vim +420 kernel/trace/trace_boot.c
30cb856e3067e5d Masami Hiramatsu 2021-08-06 396 static void __init
30cb856e3067e5d Masami Hiramatsu 2021-08-06 397 trace_boot_init_histograms(struct trace_event_file *file,
30cb856e3067e5d Masami Hiramatsu 2021-08-06 398 struct xbc_node *hnode, char *buf, size_t size)
30cb856e3067e5d Masami Hiramatsu 2021-08-06 399 {
30cb856e3067e5d Masami Hiramatsu 2021-08-06 400 struct xbc_node *node;
30cb856e3067e5d Masami Hiramatsu 2021-08-06 401 const char *p;
5d4648a0415efc2 Masami Hiramatsu 2021-08-06 402 char *tmp;
30cb856e3067e5d Masami Hiramatsu 2021-08-06 403
30cb856e3067e5d Masami Hiramatsu 2021-08-06 404 xbc_node_for_each_subkey(hnode, node) {
30cb856e3067e5d Masami Hiramatsu 2021-08-06 405 p = xbc_node_get_data(node);
30cb856e3067e5d Masami Hiramatsu 2021-08-06 406 if (!isdigit(p[0]))
30cb856e3067e5d Masami Hiramatsu 2021-08-06 407 continue;
30cb856e3067e5d Masami Hiramatsu 2021-08-06 408 /* All digit started node should be instances. */
30cb856e3067e5d Masami Hiramatsu 2021-08-06 409 if (trace_boot_compose_hist_cmd(node, buf, size) == 0) {
5d4648a0415efc2 Masami Hiramatsu 2021-08-06 410 tmp = kstrdup(buf, GFP_KERNEL);
30cb856e3067e5d Masami Hiramatsu 2021-08-06 411 if (trigger_process_regex(file, buf) < 0)
5d4648a0415efc2 Masami Hiramatsu 2021-08-06 412 pr_err("Failed to apply hist trigger: %s\n", tmp);
5d4648a0415efc2 Masami Hiramatsu 2021-08-06 413 kfree(tmp);
30cb856e3067e5d Masami Hiramatsu 2021-08-06 414 }
30cb856e3067e5d Masami Hiramatsu 2021-08-06 415 }
30cb856e3067e5d Masami Hiramatsu 2021-08-06 416
30cb856e3067e5d Masami Hiramatsu 2021-08-06 417 if (xbc_node_find_child(hnode, "keys")) {
30cb856e3067e5d Masami Hiramatsu 2021-08-06 418 if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0)
The missing curly braces here trigger a ball of static checker warnings.
I'm so happy about that. :)
5d4648a0415efc2 Masami Hiramatsu 2021-08-06 419 tmp = kstrdup(buf, GFP_KERNEL);
30cb856e3067e5d Masami Hiramatsu 2021-08-06 @420 if (trigger_process_regex(file, buf) < 0)
5d4648a0415efc2 Masami Hiramatsu 2021-08-06 @421 pr_err("Failed to apply hist trigger: %s\n", tmp);
5d4648a0415efc2 Masami Hiramatsu 2021-08-06 @422 kfree(tmp);
30cb856e3067e5d Masami Hiramatsu 2021-08-06 423 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [kbuild] [trace:ftrace/core 35/39] kernel/trace/trace_boot.c:420 trace_boot_init_histograms() warn: curly braces intended?
2021-08-31 18:45 [kbuild] [trace:ftrace/core 35/39] kernel/trace/trace_boot.c:420 trace_boot_init_histograms() warn: curly braces intended? Dan Carpenter
@ 2021-09-01 2:07 ` Masami Hiramatsu
2021-09-03 20:41 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2021-09-01 2:07 UTC (permalink / raw)
To: Dan Carpenter
Cc: kbuild, lkp, kbuild-all, linux-kernel, Steven Rostedt (VMware)
Hi Dan,
On Tue, 31 Aug 2021 21:45:11 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git ftrace/core
> head: 3dc65994e3c1c999be3d991cdc96705e167cb3b1
> commit: 5d4648a0415efc239ffb377bce1d389723eda25d [35/39] tracing/boot: Show correct histogram error command
> config: x86_64-randconfig-m001-20210831 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 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_boot.c:420 trace_boot_init_histograms() warn: curly braces intended?
> kernel/trace/trace_boot.c:421 trace_boot_init_histograms() error: uninitialized symbol 'tmp'.
> kernel/trace/trace_boot.c:421 trace_boot_init_histograms() warn: passing freed memory 'tmp'
> kernel/trace/trace_boot.c:422 trace_boot_init_histograms() error: double free of 'tmp'
>
> vim +420 kernel/trace/trace_boot.c
>
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 396 static void __init
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 397 trace_boot_init_histograms(struct trace_event_file *file,
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 398 struct xbc_node *hnode, char *buf, size_t size)
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 399 {
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 400 struct xbc_node *node;
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 401 const char *p;
> 5d4648a0415efc2 Masami Hiramatsu 2021-08-06 402 char *tmp;
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 403
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 404 xbc_node_for_each_subkey(hnode, node) {
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 405 p = xbc_node_get_data(node);
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 406 if (!isdigit(p[0]))
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 407 continue;
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 408 /* All digit started node should be instances. */
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 409 if (trace_boot_compose_hist_cmd(node, buf, size) == 0) {
> 5d4648a0415efc2 Masami Hiramatsu 2021-08-06 410 tmp = kstrdup(buf, GFP_KERNEL);
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 411 if (trigger_process_regex(file, buf) < 0)
> 5d4648a0415efc2 Masami Hiramatsu 2021-08-06 412 pr_err("Failed to apply hist trigger: %s\n", tmp);
> 5d4648a0415efc2 Masami Hiramatsu 2021-08-06 413 kfree(tmp);
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 414 }
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 415 }
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 416
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 417 if (xbc_node_find_child(hnode, "keys")) {
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 418 if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0)
>
> The missing curly braces here trigger a ball of static checker warnings.
> I'm so happy about that. :)
The ftrace/core branch has a wrong version of the patch. ftrae/for-next has
correct one. I think Steve correct this mismatch after he comes back.
Thank you,
>
> 5d4648a0415efc2 Masami Hiramatsu 2021-08-06 419 tmp = kstrdup(buf, GFP_KERNEL);
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 @420 if (trigger_process_regex(file, buf) < 0)
> 5d4648a0415efc2 Masami Hiramatsu 2021-08-06 @421 pr_err("Failed to apply hist trigger: %s\n", tmp);
> 5d4648a0415efc2 Masami Hiramatsu 2021-08-06 @422 kfree(tmp);
> 30cb856e3067e5d Masami Hiramatsu 2021-08-06 423 }
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
> _______________________________________________
> kbuild mailing list -- kbuild@lists.01.org
> To unsubscribe send an email to kbuild-leave@lists.01.org
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [kbuild] [trace:ftrace/core 35/39] kernel/trace/trace_boot.c:420 trace_boot_init_histograms() warn: curly braces intended?
2021-09-01 2:07 ` Masami Hiramatsu
@ 2021-09-03 20:41 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2021-09-03 20:41 UTC (permalink / raw)
To: Masami Hiramatsu; +Cc: Dan Carpenter, kbuild, lkp, kbuild-all, linux-kernel
On Wed, 1 Sep 2021 11:07:13 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > The missing curly braces here trigger a ball of static checker warnings.
> > I'm so happy about that. :)
>
> The ftrace/core branch has a wrong version of the patch. ftrae/for-next has
> correct one. I think Steve correct this mismatch after he comes back.
Yeah, I started focusing on my ftrace/for-next branch and stopped pushing
to ftrace/core. "core" is my development branch that can rebase, "for-next"
only rebases for adding tags, but the content should seldom change.
I already sent Linus a pull request, but I'll go and fix ftrace/core now.
Thanks for letting me know.
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-03 20:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 18:45 [kbuild] [trace:ftrace/core 35/39] kernel/trace/trace_boot.c:420 trace_boot_init_histograms() warn: curly braces intended? Dan Carpenter
2021-09-01 2:07 ` Masami Hiramatsu
2021-09-03 20:41 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).