lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200602190815.GH1169993@krava>
Date:   Tue, 2 Jun 2020 21:08:15 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Jiri Olsa <jolsa@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Michael Petlan <mpetlan@...hat.com>,
        Stephane Eranian <eranian@...gle.com>,
        Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 04/13] perf tests: Add another metric parsing test

On Tue, Jun 02, 2020 at 10:58:32AM -0700, Ian Rogers wrote:

SNIP

> > +static int check_parse_fake(const char *id)
> > +{
> > +       struct parse_events_error error;
> 
> nit: this reads funny as it isn't clear, without looking at
> check_parse_id, that error is zero initialized.

right, how about something like below?

thanks,
jirka


---
diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c
index d3343827eb4d..c745b6e13cbe 100644
--- a/tools/perf/tests/pmu-events.c
+++ b/tools/perf/tests/pmu-events.c
@@ -403,7 +403,6 @@ static int check_parse_id(const char *id, struct parse_events_error *error,
 	evlist = evlist__new();
 	if (!evlist)
 		return -ENOMEM;
-	memset(error, 0, sizeof(*error));
 	ret = parse_events(evlist, id, error, fake_pmu);
 	evlist__delete(evlist);
 	return ret;
@@ -411,7 +410,7 @@ static int check_parse_id(const char *id, struct parse_events_error *error,
 
 static int check_parse_cpu(const char *id, bool same_cpu, struct pmu_event *pe)
 {
-	struct parse_events_error error;
+	struct parse_events_error error = { 0 };
 
 	int ret = check_parse_id(id, &error, false);
 	if (ret && same_cpu) {
@@ -433,7 +432,7 @@ static int check_parse_cpu(const char *id, bool same_cpu, struct pmu_event *pe)
 
 static int check_parse_fake(const char *id)
 {
-	struct parse_events_error error;
+	struct parse_events_error error = { 0 };
 	int ret = check_parse_id(id, &error, true);
 
 	free(error.str);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ