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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e26941f9-f86c-4f2e-b812-20c49fb2c0d3@redhat.com>
Date: Mon, 12 Aug 2024 16:05:28 +0200
From: Veronika Molnarova <vmolnaro@...hat.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Adrian Hunter <adrian.hunter@...el.com>, Ian Rogers <irogers@...gle.com>,
 James Clark <james.clark@....com>, Jiri Olsa <jolsa@...nel.org>,
 Kan Liang <kan.liang@...ux.intel.com>, Michael Petlan <mpetlan@...hat.com>,
 Namhyung Kim <namhyung@...nel.org>, Radostin Stoyanov <rstoyano@...hat.com>,
 Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] perf tests pmu: Initialize all fields of test_pmu
 variable



On 8/12/24 15:03, Arnaldo Carvalho de Melo wrote:
> Instead of explicitely initializing just the .name and .alias_name,
> use struct member named initialization of just the non-null -name field,
> the compiler will initialize all the other non-explicitely initialized
> fields to NULL.
> 
> This makes the code more robust, avoiding the error recently fixed when
> the .alias_name was used and contained a random value.
> 
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Ian Rogers <irogers@...gle.com>
> Cc: James Clark <james.clark@....com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Kan Liang <kan.liang@...ux.intel.com>
> Cc: Michael Petlan <mpetlan@...hat.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Radostin Stoyanov <rstoyano@...hat.com>
> Cc: Veronika Molnarova <vmolnaro@...hat.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> ---
>  tools/perf/tests/pmu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/tests/pmu.c b/tools/perf/tests/pmu.c
> index a4730b5dc0d9259d..be18506f6a242546 100644
> --- a/tools/perf/tests/pmu.c
> +++ b/tools/perf/tests/pmu.c
> @@ -458,10 +458,10 @@ static int test__name_cmp(struct test_suite *test __maybe_unused, int subtest __
>   */
>  static int test__pmu_match(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
>  {
> -	struct perf_pmu test_pmu;
> -	test_pmu.alias_name = NULL;
> +	struct perf_pmu test_pmu = {
> +		.name = "pmuname",
> +	};
>  
> -	test_pmu.name = "pmuname";
>  	TEST_ASSERT_EQUAL("Exact match", perf_pmu__match(&test_pmu, "pmuname"),	     true);
>  	TEST_ASSERT_EQUAL("Longer token", perf_pmu__match(&test_pmu, "longertoken"), false);
>  	TEST_ASSERT_EQUAL("Shorter token", perf_pmu__match(&test_pmu, "pmu"),	     false);

Reviewed-by: Veronika Molnarova <vmolnaro@...hat.com>

Thanks for the rework,
Veronika


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ