Messages in this thread | | | Date | Sun, 5 Dec 2021 16:13:46 +0100 | From | Jiri Olsa <> | Subject | Re: [PATCH v12 13/16] perf record: Extend --threads command line option |
| |
On Tue, Nov 23, 2021 at 05:08:09PM +0300, Alexey Bayduraev wrote:
SNIP
> + > static int record__parse_threads(const struct option *opt, const char *str, int unset) > { > + int s; > struct record_opts *opts = opt->value; > > - if (unset || !str || !strlen(str)) > + if (unset || !str || !strlen(str)) { > opts->threads_spec = THREAD_SPEC__CPU; > + } else { > + for (s = 1; s < THREAD_SPEC__MAX; s++) { > + if (s == THREAD_SPEC__USER) { > + opts->threads_user_spec = strdup(str);
we should bail out if strdup fails
jirka
> + opts->threads_spec = THREAD_SPEC__USER; > + break; > + } > + if (!strncasecmp(str, thread_spec_tags[s], strlen(thread_spec_tags[s]))) { > + opts->threads_spec = s; > + break; > + } > + } > + } > + > + if (opts->threads_spec == THREAD_SPEC__USER) > + pr_debug("threads_spec: %s\n", opts->threads_user_spec); > + else > + pr_debug("threads_spec: %s\n", thread_spec_tags[opts->threads_spec]); > > return 0; > } > @@ -3263,6 +3327,17 @@ static void record__mmap_cpu_mask_init(struct mmap_cpu_mask *mask, struct perf_c > set_bit(cpus->map[c], mask->bits); > } >
SNIP
| |