Commit 92bd6820 authored by Chang-Hsien Tsai's avatar Chang-Hsien Tsai Committed by Daniel Borkmann

bpf: style fix in while(!feof()) loop

Use fgets() as the while loop condition.
Signed-off-by: default avatarChang-Hsien Tsai <luke.tw@gmail.com>
Acked-by: default avatarYonghong Song <yhs@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent e1afb702
...@@ -31,9 +31,7 @@ void kernel_syms_load(struct dump_data *dd) ...@@ -31,9 +31,7 @@ void kernel_syms_load(struct dump_data *dd)
if (!fp) if (!fp)
return; return;
while (!feof(fp)) { while (fgets(buff, sizeof(buff), fp)) {
if (!fgets(buff, sizeof(buff), fp))
break;
tmp = reallocarray(dd->sym_mapping, dd->sym_count + 1, tmp = reallocarray(dd->sym_mapping, dd->sym_count + 1,
sizeof(*dd->sym_mapping)); sizeof(*dd->sym_mapping));
if (!tmp) { if (!tmp) {
......
...@@ -30,9 +30,7 @@ int load_kallsyms(void) ...@@ -30,9 +30,7 @@ int load_kallsyms(void)
if (!f) if (!f)
return -ENOENT; return -ENOENT;
while (!feof(f)) { while (fgets(buf, sizeof(buf), f)) {
if (!fgets(buf, sizeof(buf), f))
break;
if (sscanf(buf, "%p %c %s", &addr, &symbol, func) != 3) if (sscanf(buf, "%p %c %s", &addr, &symbol, func) != 3)
break; break;
if (!addr) if (!addr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment