bpf: style fix in while(!feof()) loop
authorChang-Hsien Tsai <luke.tw@gmail.com>
Sun, 26 May 2019 10:32:11 +0000 (10:32 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 28 May 2019 08:54:01 +0000 (10:54 +0200)
Use fgets() as the while loop condition.

Signed-off-by: Chang-Hsien Tsai <luke.tw@gmail.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/bpf/bpftool/xlated_dumper.c
tools/testing/selftests/bpf/trace_helpers.c

index 0bb17bf88b188378cd863e733683a0e9da131c77..494d7ae3614dea003d2bd774917a3f27e4d119ca 100644 (file)
@@ -31,9 +31,7 @@ void kernel_syms_load(struct dump_data *dd)
        if (!fp)
                return;
 
-       while (!feof(fp)) {
-               if (!fgets(buff, sizeof(buff), fp))
-                       break;
+       while (fgets(buff, sizeof(buff), fp)) {
                tmp = reallocarray(dd->sym_mapping, dd->sym_count + 1,
                                   sizeof(*dd->sym_mapping));
                if (!tmp) {
index 9a9fc6c9b70b5660ee83bca010b98b4af704dd2f..b47f205f0310340cc9048888c12b5a009502a198 100644 (file)
@@ -30,9 +30,7 @@ int load_kallsyms(void)
        if (!f)
                return -ENOENT;
 
-       while (!feof(f)) {
-               if (!fgets(buf, sizeof(buf), f))
-                       break;
+       while (fgets(buf, sizeof(buf), f)) {
                if (sscanf(buf, "%p %c %s", &addr, &symbol, func) != 3)
                        break;
                if (!addr)