Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Check vmlinux/kallsyms arguments in all tools

Only perf report checked the validity of these arguments so apply the
same check to all tools that read them for consistency.

Signed-off-by: James Clark <james.clark@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Denis Nikitin <denik@chromium.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20211018134844.2627174-3-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

James Clark and committed by
Arnaldo Carvalho de Melo
7cc72553 a3df50ab

+28
+4
tools/perf/builtin-annotate.c
··· 591 591 return ret; 592 592 } 593 593 594 + ret = symbol__validate_sym_arguments(); 595 + if (ret) 596 + return ret; 597 + 594 598 if (quiet) 595 599 perf_quiet_option(); 596 600
+4
tools/perf/builtin-c2c.c
··· 2768 2768 if (c2c.stats_only) 2769 2769 c2c.use_stdio = true; 2770 2770 2771 + err = symbol__validate_sym_arguments(); 2772 + if (err) 2773 + goto out; 2774 + 2771 2775 if (!input_name || !strlen(input_name)) 2772 2776 input_name = "perf.data"; 2773 2777
+5
tools/perf/builtin-probe.c
··· 21 21 #include "util/build-id.h" 22 22 #include "util/strlist.h" 23 23 #include "util/strfilter.h" 24 + #include "util/symbol.h" 24 25 #include "util/symbol_conf.h" 25 26 #include "util/debug.h" 26 27 #include <subcmd/parse-options.h> ··· 629 628 } 630 629 params.command = 'a'; 631 630 } 631 + 632 + ret = symbol__validate_sym_arguments(); 633 + if (ret) 634 + return ret; 632 635 633 636 if (params.quiet) { 634 637 if (verbose != 0) {
+4
tools/perf/builtin-record.c
··· 2712 2712 if (quiet) 2713 2713 perf_quiet_option(); 2714 2714 2715 + err = symbol__validate_sym_arguments(); 2716 + if (err) 2717 + return err; 2718 + 2715 2719 /* Make system wide (-a) the default target. */ 2716 2720 if (!argc && target__none(&rec->opts.target)) 2717 2721 rec->opts.target.system_wide = true;
+4
tools/perf/builtin-sched.c
··· 3538 3538 .fork_event = replay_fork_event, 3539 3539 }; 3540 3540 unsigned int i; 3541 + int ret; 3541 3542 3542 3543 for (i = 0; i < ARRAY_SIZE(sched.curr_pid); i++) 3543 3544 sched.curr_pid[i] = -1; ··· 3599 3598 parse_options_usage(NULL, timehist_options, "n", true); 3600 3599 return -EINVAL; 3601 3600 } 3601 + ret = symbol__validate_sym_arguments(); 3602 + if (ret) 3603 + return ret; 3602 3604 3603 3605 return perf_sched__timehist(&sched); 3604 3606 } else {
+3
tools/perf/builtin-script.c
··· 3846 3846 data.path = input_name; 3847 3847 data.force = symbol_conf.force; 3848 3848 3849 + if (symbol__validate_sym_arguments()) 3850 + return -1; 3851 + 3849 3852 if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) { 3850 3853 rec_script_path = get_script_path(argv[1], RECORD_SUFFIX); 3851 3854 if (!rec_script_path)
+4
tools/perf/builtin-top.c
··· 1618 1618 if (argc) 1619 1619 usage_with_options(top_usage, options); 1620 1620 1621 + status = symbol__validate_sym_arguments(); 1622 + if (status) 1623 + goto out_delete_evlist; 1624 + 1621 1625 if (annotate_check_args(&top.annotation_opts) < 0) 1622 1626 goto out_delete_evlist; 1623 1627