Re: [PATCH bpf-next 2/2] libbpf: fix legacy kprobe event creation FD error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 20, 2021 at 11:20 AM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote:
>
> open() returns -1 on error, not zero FD. Fix the error handling logic.
> Reported by Coverity statis analysis.
>
> Fixes: ca304b40c20d ("libbpf: Introduce legacy kprobe events support")
> Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> ---

This patch is superseded by a new patch series ([0]), please don't apply.

  [0] https://patchwork.kernel.org/project/netdevbpf/list/?series=550083&state=*

>  tools/lib/bpf/libbpf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 6d2f12db6034..761497be6ffc 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -9036,7 +9036,7 @@ static int poke_kprobe_events(bool add, const char *name, bool retprobe, uint64_
>         }
>
>         fd = open(file, O_WRONLY | O_APPEND, 0);
> -       if (!fd)
> +       if (fd < 0)
>                 return -errno;
>         ret = write(fd, cmd, strlen(cmd));
>         if (ret < 0)
> --
> 2.30.2
>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux