[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111061940.qM73Nx1d-lkp@intel.com>
Date: Sat, 6 Nov 2021 19:15:50 +0800
From: kernel test robot <lkp@...el.com>
To: Tom Zanussi <zanussi@...nel.org>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [zanussi-trace:ftrace/cleanup-hist-func-v1 2/2]
kernel/trace/trace_events_trigger.c:815:26: warning: variable 'trigger_ops'
is uninitialized when used here
tree: https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git ftrace/cleanup-hist-func-v1
head: 61eeb0efea39a7cae67ea43f3fe553559e0eb2b7
commit: 61eeb0efea39a7cae67ea43f3fe553559e0eb2b7 [2/2] tracing: Have existing event_command implementations use helpers
config: i386-buildonly-randconfig-r001-20211105 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 627868263cd4d57c230b61904483a3dad9e1a1da)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git/commit/?id=61eeb0efea39a7cae67ea43f3fe553559e0eb2b7
git remote add zanussi-trace https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git
git fetch --no-tags zanussi-trace ftrace/cleanup-hist-func-v1
git checkout 61eeb0efea39a7cae67ea43f3fe553559e0eb2b7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
kernel/trace/trace_events_trigger.c:685:6: warning: no previous prototype for function 'event_trigger_remove' [-Wmissing-prototypes]
void event_trigger_remove(struct event_command *cmd_ops,
^
kernel/trace/trace_events_trigger.c:685:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void event_trigger_remove(struct event_command *cmd_ops,
^
static
>> kernel/trace/trace_events_trigger.c:815:26: warning: variable 'trigger_ops' is uninitialized when used here [-Wuninitialized]
cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
^~~~~~~~~~~
kernel/trace/trace_events_trigger.c:800:39: note: initialize the variable 'trigger_ops' to silence this warning
struct event_trigger_ops *trigger_ops;
^
= NULL
2 warnings generated.
vim +/trigger_ops +815 kernel/trace/trace_events_trigger.c
bc058fce125e07 Tom Zanussi 2021-11-05 684
bc058fce125e07 Tom Zanussi 2021-11-05 @685 void event_trigger_remove(struct event_command *cmd_ops,
bc058fce125e07 Tom Zanussi 2021-11-05 686 struct trace_event_file *file,
bc058fce125e07 Tom Zanussi 2021-11-05 687 char *glob,
bc058fce125e07 Tom Zanussi 2021-11-05 688 char *cmd,
bc058fce125e07 Tom Zanussi 2021-11-05 689 char *trigger,
bc058fce125e07 Tom Zanussi 2021-11-05 690 struct event_trigger_data **trigger_data)
bc058fce125e07 Tom Zanussi 2021-11-05 691 {
bc058fce125e07 Tom Zanussi 2021-11-05 692 struct event_trigger_ops *trigger_ops;
bc058fce125e07 Tom Zanussi 2021-11-05 693
bc058fce125e07 Tom Zanussi 2021-11-05 694 trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger);
bc058fce125e07 Tom Zanussi 2021-11-05 695
bc058fce125e07 Tom Zanussi 2021-11-05 696 cmd_ops->unreg(glob+1, trigger_ops, *trigger_data, file);
bc058fce125e07 Tom Zanussi 2021-11-05 697
bc058fce125e07 Tom Zanussi 2021-11-05 698 kfree(*trigger_data);
bc058fce125e07 Tom Zanussi 2021-11-05 699
bc058fce125e07 Tom Zanussi 2021-11-05 700 *trigger_data = NULL;
bc058fce125e07 Tom Zanussi 2021-11-05 701 }
bc058fce125e07 Tom Zanussi 2021-11-05 702
bc058fce125e07 Tom Zanussi 2021-11-05 703 int event_trigger_parse_num(char *trigger,
bc058fce125e07 Tom Zanussi 2021-11-05 704 struct event_trigger_data *trigger_data)
bc058fce125e07 Tom Zanussi 2021-11-05 705 {
bc058fce125e07 Tom Zanussi 2021-11-05 706 char *number;
bc058fce125e07 Tom Zanussi 2021-11-05 707 int ret = 0;
bc058fce125e07 Tom Zanussi 2021-11-05 708
bc058fce125e07 Tom Zanussi 2021-11-05 709 if (trigger) {
bc058fce125e07 Tom Zanussi 2021-11-05 710 number = strsep(&trigger, ":");
bc058fce125e07 Tom Zanussi 2021-11-05 711
bc058fce125e07 Tom Zanussi 2021-11-05 712 if (!strlen(number))
bc058fce125e07 Tom Zanussi 2021-11-05 713 return -EINVAL;
bc058fce125e07 Tom Zanussi 2021-11-05 714
bc058fce125e07 Tom Zanussi 2021-11-05 715 /*
bc058fce125e07 Tom Zanussi 2021-11-05 716 * We use the callback data field (which is a pointer)
bc058fce125e07 Tom Zanussi 2021-11-05 717 * as our counter.
bc058fce125e07 Tom Zanussi 2021-11-05 718 */
bc058fce125e07 Tom Zanussi 2021-11-05 719 ret = kstrtoul(number, 0, &trigger_data->count);
bc058fce125e07 Tom Zanussi 2021-11-05 720 }
bc058fce125e07 Tom Zanussi 2021-11-05 721
bc058fce125e07 Tom Zanussi 2021-11-05 722 return ret;
bc058fce125e07 Tom Zanussi 2021-11-05 723 }
bc058fce125e07 Tom Zanussi 2021-11-05 724
bc058fce125e07 Tom Zanussi 2021-11-05 725 int event_trigger_set_filter(struct event_command *cmd_ops,
bc058fce125e07 Tom Zanussi 2021-11-05 726 struct trace_event_file *file,
bc058fce125e07 Tom Zanussi 2021-11-05 727 char *param,
bc058fce125e07 Tom Zanussi 2021-11-05 728 struct event_trigger_data *trigger_data)
bc058fce125e07 Tom Zanussi 2021-11-05 729 {
bc058fce125e07 Tom Zanussi 2021-11-05 730 if (param && cmd_ops->set_filter)
bc058fce125e07 Tom Zanussi 2021-11-05 731 return cmd_ops->set_filter(param, trigger_data, file);
bc058fce125e07 Tom Zanussi 2021-11-05 732
bc058fce125e07 Tom Zanussi 2021-11-05 733 return 0;
bc058fce125e07 Tom Zanussi 2021-11-05 734 }
bc058fce125e07 Tom Zanussi 2021-11-05 735
bc058fce125e07 Tom Zanussi 2021-11-05 736 void event_trigger_reset_filter(struct event_command *cmd_ops,
bc058fce125e07 Tom Zanussi 2021-11-05 737 struct event_trigger_data *trigger_data)
bc058fce125e07 Tom Zanussi 2021-11-05 738 {
bc058fce125e07 Tom Zanussi 2021-11-05 739 if (cmd_ops->set_filter)
bc058fce125e07 Tom Zanussi 2021-11-05 740 cmd_ops->set_filter(NULL, trigger_data, NULL);
bc058fce125e07 Tom Zanussi 2021-11-05 741 }
bc058fce125e07 Tom Zanussi 2021-11-05 742
bc058fce125e07 Tom Zanussi 2021-11-05 743 int event_trigger_register(struct event_command *cmd_ops,
bc058fce125e07 Tom Zanussi 2021-11-05 744 struct trace_event_file *file,
bc058fce125e07 Tom Zanussi 2021-11-05 745 char *glob,
bc058fce125e07 Tom Zanussi 2021-11-05 746 char *cmd,
bc058fce125e07 Tom Zanussi 2021-11-05 747 char *trigger,
bc058fce125e07 Tom Zanussi 2021-11-05 748 struct event_trigger_data *trigger_data,
bc058fce125e07 Tom Zanussi 2021-11-05 749 int *n_registered)
bc058fce125e07 Tom Zanussi 2021-11-05 750 {
bc058fce125e07 Tom Zanussi 2021-11-05 751 struct event_trigger_ops *trigger_ops;
bc058fce125e07 Tom Zanussi 2021-11-05 752 int ret;
bc058fce125e07 Tom Zanussi 2021-11-05 753
bc058fce125e07 Tom Zanussi 2021-11-05 754 if (n_registered)
bc058fce125e07 Tom Zanussi 2021-11-05 755 *n_registered = 0;
bc058fce125e07 Tom Zanussi 2021-11-05 756
bc058fce125e07 Tom Zanussi 2021-11-05 757 trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger);
bc058fce125e07 Tom Zanussi 2021-11-05 758
bc058fce125e07 Tom Zanussi 2021-11-05 759 ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
bc058fce125e07 Tom Zanussi 2021-11-05 760 /*
bc058fce125e07 Tom Zanussi 2021-11-05 761 * The above returns on success the # of functions enabled,
bc058fce125e07 Tom Zanussi 2021-11-05 762 * but if it didn't find any functions it returns zero.
bc058fce125e07 Tom Zanussi 2021-11-05 763 * Consider no functions a failure too.
bc058fce125e07 Tom Zanussi 2021-11-05 764 */
bc058fce125e07 Tom Zanussi 2021-11-05 765 if (!ret) {
bc058fce125e07 Tom Zanussi 2021-11-05 766 cmd_ops->unreg(glob, trigger_ops, trigger_data, file);
bc058fce125e07 Tom Zanussi 2021-11-05 767 ret = -ENOENT;
bc058fce125e07 Tom Zanussi 2021-11-05 768 } else if (ret > 0) {
bc058fce125e07 Tom Zanussi 2021-11-05 769 if (n_registered)
bc058fce125e07 Tom Zanussi 2021-11-05 770 *n_registered = ret;
bc058fce125e07 Tom Zanussi 2021-11-05 771 /* Just return zero, not the number of enabled functions */
bc058fce125e07 Tom Zanussi 2021-11-05 772 ret = 0;
bc058fce125e07 Tom Zanussi 2021-11-05 773 }
bc058fce125e07 Tom Zanussi 2021-11-05 774
bc058fce125e07 Tom Zanussi 2021-11-05 775 return ret;
bc058fce125e07 Tom Zanussi 2021-11-05 776 }
bc058fce125e07 Tom Zanussi 2021-11-05 777
2a2df321158817 Tom Zanussi 2013-10-24 778 /**
2a2df321158817 Tom Zanussi 2013-10-24 779 * event_trigger_callback - Generic event_command @func implementation
2a2df321158817 Tom Zanussi 2013-10-24 780 * @cmd_ops: The command ops, used for trigger registration
7f1d2f8210195c Steven Rostedt (Red Hat 2015-05-05 781) * @file: The trace_event_file associated with the event
2a2df321158817 Tom Zanussi 2013-10-24 782 * @glob: The raw string used to register the trigger
2a2df321158817 Tom Zanussi 2013-10-24 783 * @cmd: The cmd portion of the string used to register the trigger
2a2df321158817 Tom Zanussi 2013-10-24 784 * @param: The params portion of the string used to register the trigger
2a2df321158817 Tom Zanussi 2013-10-24 785 *
2a2df321158817 Tom Zanussi 2013-10-24 786 * Common implementation for event command parsing and trigger
2a2df321158817 Tom Zanussi 2013-10-24 787 * instantiation.
2a2df321158817 Tom Zanussi 2013-10-24 788 *
2a2df321158817 Tom Zanussi 2013-10-24 789 * Usually used directly as the @func method in event command
2a2df321158817 Tom Zanussi 2013-10-24 790 * implementations.
2a2df321158817 Tom Zanussi 2013-10-24 791 *
2a2df321158817 Tom Zanussi 2013-10-24 792 * Return: 0 on success, errno otherwise
2a2df321158817 Tom Zanussi 2013-10-24 793 */
2a2df321158817 Tom Zanussi 2013-10-24 794 static int
2a2df321158817 Tom Zanussi 2013-10-24 795 event_trigger_callback(struct event_command *cmd_ops,
7f1d2f8210195c Steven Rostedt (Red Hat 2015-05-05 796) struct trace_event_file *file,
2a2df321158817 Tom Zanussi 2013-10-24 797 char *glob, char *cmd, char *param)
2a2df321158817 Tom Zanussi 2013-10-24 798 {
2a2df321158817 Tom Zanussi 2013-10-24 799 struct event_trigger_data *trigger_data;
2a2df321158817 Tom Zanussi 2013-10-24 800 struct event_trigger_ops *trigger_ops;
2a2df321158817 Tom Zanussi 2013-10-24 801 char *trigger = NULL;
61eeb0efea39a7 Tom Zanussi 2021-11-05 802 bool remove;
2a2df321158817 Tom Zanussi 2013-10-24 803 int ret;
2a2df321158817 Tom Zanussi 2013-10-24 804
61eeb0efea39a7 Tom Zanussi 2021-11-05 805 ret = event_trigger_check(glob, &trigger, ¶m, &remove, false, true);
61eeb0efea39a7 Tom Zanussi 2021-11-05 806 if (ret)
61eeb0efea39a7 Tom Zanussi 2021-11-05 807 return ret;
2a2df321158817 Tom Zanussi 2013-10-24 808
2a2df321158817 Tom Zanussi 2013-10-24 809 ret = -ENOMEM;
61eeb0efea39a7 Tom Zanussi 2021-11-05 810 trigger_data = event_trigger_alloc(cmd_ops, trigger, cmd, file);
2a2df321158817 Tom Zanussi 2013-10-24 811 if (!trigger_data)
2a2df321158817 Tom Zanussi 2013-10-24 812 goto out;
2a2df321158817 Tom Zanussi 2013-10-24 813
61eeb0efea39a7 Tom Zanussi 2021-11-05 814 if (remove) {
2a2df321158817 Tom Zanussi 2013-10-24 @815 cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
2a2df321158817 Tom Zanussi 2013-10-24 816 ret = 0;
2a2df321158817 Tom Zanussi 2013-10-24 817 goto out;
2a2df321158817 Tom Zanussi 2013-10-24 818 }
2a2df321158817 Tom Zanussi 2013-10-24 819
61eeb0efea39a7 Tom Zanussi 2021-11-05 820 ret = event_trigger_parse_num(trigger, trigger_data);
2a2df321158817 Tom Zanussi 2013-10-24 821 if (ret)
2a2df321158817 Tom Zanussi 2013-10-24 822 goto out_free;
2a2df321158817 Tom Zanussi 2013-10-24 823
61eeb0efea39a7 Tom Zanussi 2021-11-05 824 ret = event_trigger_set_filter(cmd_ops, file, param, trigger_data);
2a2df321158817 Tom Zanussi 2013-10-24 825 if (ret < 0)
2a2df321158817 Tom Zanussi 2013-10-24 826 goto out_free;
2a2df321158817 Tom Zanussi 2013-10-24 827
1863c387259b62 Steven Rostedt (VMware 2018-07-24 828) /* Up the trigger_data count to make sure reg doesn't free it on failure */
1863c387259b62 Steven Rostedt (VMware 2018-07-24 829) event_trigger_init(trigger_ops, trigger_data);
61eeb0efea39a7 Tom Zanussi 2021-11-05 830
61eeb0efea39a7 Tom Zanussi 2021-11-05 831 ret = event_trigger_register(cmd_ops, file, glob, cmd, trigger, trigger_data, NULL);
61eeb0efea39a7 Tom Zanussi 2021-11-05 832 if (ret)
61eeb0efea39a7 Tom Zanussi 2021-11-05 833 goto out_free;
1863c387259b62 Steven Rostedt (VMware 2018-07-24 834)
1863c387259b62 Steven Rostedt (VMware 2018-07-24 835) /* Down the counter of trigger_data or free it if not used anymore */
1863c387259b62 Steven Rostedt (VMware 2018-07-24 836) event_trigger_free(trigger_ops, trigger_data);
2a2df321158817 Tom Zanussi 2013-10-24 837 out:
2a2df321158817 Tom Zanussi 2013-10-24 838 return ret;
2a2df321158817 Tom Zanussi 2013-10-24 839 out_free:
61eeb0efea39a7 Tom Zanussi 2021-11-05 840 event_trigger_reset_filter(cmd_ops, trigger_data);
2a2df321158817 Tom Zanussi 2013-10-24 841 kfree(trigger_data);
2a2df321158817 Tom Zanussi 2013-10-24 842 goto out;
2a2df321158817 Tom Zanussi 2013-10-24 843 }
2a2df321158817 Tom Zanussi 2013-10-24 844
:::::: The code at line 815 was first introduced by commit
:::::: 2a2df321158817811c5dc206dce808e0aa9f6d89 tracing: Add 'traceon' and 'traceoff' event trigger commands
:::::: TO: Tom Zanussi <tom.zanussi@...ux.intel.com>
:::::: CC: Steven Rostedt <rostedt@...dmis.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (35405 bytes)
Powered by blists - more mailing lists