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: <CAEf4BzboYd4y53KjKwNMCqE6oV9ms0zbtKCGweEGtjZvCe1f0w@mail.gmail.com>
Date:   Thu, 17 Feb 2022 13:47:16 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Jiri Olsa <jolsa@...nel.org>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Ingo Molnar <mingo@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Ian Rogers <irogers@...gle.com>,
        "linux-perf-use." <linux-perf-users@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH 1/3] perf tools: Remove bpf_program__set_priv/bpf_program__priv
 usage

On Thu, Feb 17, 2022 at 5:19 AM Jiri Olsa <jolsa@...nel.org> wrote:
>
> Both bpf_program__set_priv/bpf_program__priv are deprecated
> and will be eventually removed.
>
> Using hashmap to replace that functionality.
>
> Suggested-by: Andrii Nakryiko <andrii@...nel.org>
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  tools/perf/util/bpf-loader.c | 91 +++++++++++++++++++++++++++++-------
>  1 file changed, 75 insertions(+), 16 deletions(-)
>

[...]

> +
> +static int program_set_priv(struct bpf_program *prog, void *priv)
> +{
> +       void *old_priv;
> +
> +       if (!bpf_program_hash) {
> +               bpf_program_hash = hashmap__new(ptr_hash, ptr_equal, NULL);
> +               if (!bpf_program_hash)

should use IS_ERR here

> +                       return -ENOMEM;
> +       }
> +
> +       old_priv = program_priv(prog);
> +       if (old_priv) {
> +               clear_prog_priv(prog, old_priv);
> +               return hashmap__set(bpf_program_hash, prog, priv, NULL, NULL);
> +       }
> +       return hashmap__add(bpf_program_hash, prog, priv);
>  }

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ