Re: [PATCH bpf-next] bpftool: fix output for skipping kernel config check

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

 



On Thu, Dec 08, 2022 at 03:32:33PM -0800, Andrii Nakryiko wrote:
> On Mon, Dec 5, 2022 at 8:41 PM Chethan Suresh <chethan.suresh@xxxxxxxx> wrote:
> >
> > 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.
> >
> > Signed-off-by: Chethan Suresh <chethan.suresh@xxxxxxxx>
> > Signed-off-by: Kenta Tada <Kenta.Tada@xxxxxxxx>
> > ---
> >  tools/bpf/bpftool/feature.c | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c
> > index 36cf0f1517c9..316c4a01bdb7 100644
> > --- a/tools/bpf/bpftool/feature.c
> > +++ b/tools/bpf/bpftool/feature.c
> > @@ -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.
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.
> 
> >                 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]);
> > +               }
> >         }
> >  }
> >
> > --
> > 2.17.1
> >




[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