bpftool: fix output for skipping kernel config check
PATCH 1/1 bpftool: fix output for skipping kernel config check
When bpftool feature does not find kernel config files under default path, do not output CONFIG_XYZ is not set. Skip kernel config check and continue.
--- tools/bpf/bpftool/feature.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tools/bpf/bpftool/feature.c +7 -7
@@ -487,14 +487,14 @@ static void probe_kernel_image_config(const char *define_prefix) } end_parse: -if (file) +if (file) {gzclose (file); - -for (i =0 ; i <ARRAY_SIZE (options); i++) { -if (define_prefix && !options[i].macro_dump) -continue ; -print_kernel_option (options[i].name, values[i], define_prefix); -free (values[i]); +for (i =0 ; i <ARRAY_SIZE (options); i++) { +if (define_prefix && !options[i].macro_dump) +continue ; +print_kernel_option (options[i].name, values[i], define_prefix); +free (values[i]); + } } }
Signature · 1 line
2.17.1
Quoted 16 lines · Chethan Suresh
When bpftool feature does not find kernel config files under default path, do not output
CONFIG_XYZis not set. Skip kernel config check and continue.Signed-off-by Chethan Suresh <[email protected]>Signed-off-by Kenta Tada <[email protected]>--- tools/bpf/bpftool/feature.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)tools/bpf/bpftool/feature.c +0
-0
tools/bpf/bpftool/feature.c static void probe_kernel_image_config(const char *define_prefix) · line 490
Quoted 5 lines
tools/bpf/bpftool/feature.c +1
-1@@ -487,14 +487,14 @@ static void probe_kernel_image_config(const char *define_prefix) } end_parse: -if (file) +if (file) {
There are two error conditions when file != NULL but we actually don't read kconfig contents. Please handle those properly, otherwise all the same confusion will keep happening.
Quoted 19 lines
tools/bpf/bpftool/feature.c +6
-7gzclose (file); - -for (i =0 ; i <ARRAY_SIZE (options); i++) { -if (define_prefix && !options[i].macro_dump) -continue ; -print_kernel_option (options[i].name, values[i], define_prefix); -free (values[i]); +for (i =0 ; i <ARRAY_SIZE (options); i++) { +if (define_prefix && !options[i].macro_dump) +continue ; +print_kernel_option (options[i].name, values[i], define_prefix); +free (values[i]); + } } } --2.17.1
Quoted 19 lines · Andrii Nakryiko
Quoted 18 lines · Chethan Suresh
When bpftool feature does not find kernel config files under default path, do not output
CONFIG_XYZis not set. Skip kernel config check and continue.Signed-off-by Chethan Suresh <[email protected]>Signed-off-by Kenta Tada <[email protected]>--- tools/bpf/bpftool/feature.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)tools/bpf/bpftool/feature.c +0
-0@@ -487,14 +487,14 @@ static void probe_kernel_image_config(const char *define_prefix) }
Quoted 7 lines
tools/bpf/bpftool/feature.c static void probe_kernel_image_config(const char *define_prefix) · line 490
Quoted 3 lines
tools/bpf/bpftool/feature.c +1
-1end_parse: -if (file) +if (file) {There are two error conditions when file != NULL but we actually don't read kconfig contents. Please handle those properly, otherwise all the same confusion will keep happening.
As I understand, the check should skip when file != NULL itself rather than handling it in end_parse.
I'll send the updated patch based on review.
Quoted 20 lines
Quoted 20 lines
tools/bpf/bpftool/feature.c +6
-7gzclose (file); - -for (i =0 ; i <ARRAY_SIZE (options); i++) { -if (define_prefix && !options[i].macro_dump) -continue ; -print_kernel_option (options[i].name, values[i], define_prefix); -free (values[i]); +for (i =0 ; i <ARRAY_SIZE (options); i++) { +if (define_prefix && !options[i].macro_dump) +continue ; +print_kernel_option (options[i].name, values[i], define_prefix); +free (values[i]); + } } } --2.17.1