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  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]
Date:   Thu, 13 Aug 2020 17:36:49 +0530
From:   Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To:     Alexander Gordeev <agordeev@...ux.ibm.com>
Cc:     Namhyung Kim <namhyung@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Satheesh Rajendran <sathnaga@...ux.vnet.ibm.com>,
        "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
        Balamuruhan S <bala24@...ux.vnet.ibm.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>
Subject: Re: [PATCH v3 1/2] perf bench numa: fix cpumask memory leak in
 node_has_cpus()

* Alexander Gordeev <agordeev@...ux.ibm.com> [2020-08-13 13:30:42]:

> Couple numa_allocate_cpumask() and numa_free_cpumask() functions
> 
> Signed-off-by: Alexander Gordeev <agordeev@...ux.ibm.com>
> ---
>  tools/perf/bench/numa.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
> index 31e2601..9066511 100644
> --- a/tools/perf/bench/numa.c
> +++ b/tools/perf/bench/numa.c
> @@ -248,16 +248,21 @@ static int is_node_present(int node)
>  static bool node_has_cpus(int node)
>  {
>  	struct bitmask *cpu = numa_allocate_cpumask();
> +	bool ret = false; /* fall back to nocpus */
>  	unsigned int i;
> 
> -	if (cpu && !numa_node_to_cpus(node, cpu)) {
> +	BUG_ON(!cpu);
> +	if (!numa_node_to_cpus(node, cpu)) {
>  		for (i = 0; i < cpu->size; i++) {
> -			if (numa_bitmask_isbitset(cpu, i))
> -				return true;
> +			if (numa_bitmask_isbitset(cpu, i)) {
> +				ret = true;
> +				break;
> +			}
>  		}
>  	}
> +	numa_free_cpumask(cpu);
> 
> -	return false; /* lets fall back to nocpus safely */
> +	return ret;
>  }
> 
>  static cpu_set_t bind_to_cpu(int target_cpu)
> -- 
> 1.8.3.1
> 

Looks good to me.

Reviewed-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>

-- 
Thanks and Regards
Srikar Dronamraju

Powered by blists - more mailing lists