[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191021135502.GC32718@krava>
Date: Mon, 21 Oct 2019 15:55:02 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Yonghong Song <yhs@...com>
Cc: Andrii Nakryiko <andriin@...com>, Jiri Olsa <jolsa@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
Martin Lau <kafai@...com>
Subject: Re: [PATCH] bpftool: Try to read btf as raw data if elf read fails
On Fri, Oct 18, 2019 at 08:04:44PM +0000, Yonghong Song wrote:
SNIP
> >> + FILE *f;
> >> +
> >> + if (stat(file, &st))
> >> + return btf;
> >> +
> >> + f = fopen(file, "rb");
> >> + if (!f)
> >> + return btf;
> >> +
> >> + buf = malloc(st.st_size);
> >> + if (!buf)
> >> + goto err;
> >> +
> >> + if ((size_t) st.st_size != fread(buf, 1, st.st_size, f))
> >> + goto err;
> >> +
> >> + btf = btf__new(buf, st.st_size);
> >> +
> >> +err:
>
> Non error case can also reach here. Let us change
> label to a different name, e.g., "done"?
ok, will change
thanks,
jirka
Powered by blists - more mailing lists