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: <CAPhsuW5AzLfRcNOSRRN9YvUocMxpR2eoH6uGgwdBjqFwZPxBAw@mail.gmail.com>
Date:   Wed, 29 May 2019 10:24:51 -0700
From:   Song Liu <liu.song.a23@...il.com>
To:     Andrii Nakryiko <andriin@...com>
Cc:     Andrii Nakryiko <andrii.nakryiko@...il.com>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Alexei Starovoitov <ast@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next 7/9] libbpf: simplify two pieces of logic

On Tue, May 28, 2019 at 6:14 PM Andrii Nakryiko <andriin@...com> wrote:
>
> Extra check for type is unnecessary in first case.
>
> Extra zeroing is unnecessary, as snprintf guarantees that it will
> zero-terminate string.
>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
Acked-by: Song Liu <songliubraving@...com>

> ---
>  tools/lib/bpf/libbpf.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 292ea9a2dc3d..e3bc00933145 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -1430,8 +1430,7 @@ bpf_program__collect_reloc(struct bpf_program *prog, GElf_Shdr *shdr,
>                                 if (maps[map_idx].libbpf_type != type)
>                                         continue;
>                                 if (type != LIBBPF_MAP_UNSPEC ||
> -                                   (type == LIBBPF_MAP_UNSPEC &&
> -                                    maps[map_idx].offset == sym.st_value)) {
> +                                   maps[map_idx].offset == sym.st_value) {
>                                         pr_debug("relocation: find map %zd (%s) for insn %u\n",
>                                                  map_idx, maps[map_idx].name, insn_idx);
>                                         break;
> @@ -2354,7 +2353,6 @@ struct bpf_object *bpf_object__open_buffer(void *obj_buf,
>                 snprintf(tmp_name, sizeof(tmp_name), "%lx-%lx",
>                          (unsigned long)obj_buf,
>                          (unsigned long)obj_buf_sz);
> -               tmp_name[sizeof(tmp_name) - 1] = '\0';
>                 name = tmp_name;
>         }
>         pr_debug("loading object '%s' from buffer\n",
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ