Re: [PATCH bpf-next 3/4] bpftool: Fix incorrect return in generated detach helper

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

 



On Tue, Apr 26, 2022 at 2:47 PM Andrii Nakryiko
<andrii.nakryiko@xxxxxxxxx> wrote:
>
> On Sat, Apr 23, 2022 at 7:02 AM Yafang Shao <laoar.shao@xxxxxxxxx> wrote:
> >
> > There is no return value of bpf_object__detach_skeleton(), so we'd
> > better not return it, that is formal.
> >
> > Fixes: 5dc7a8b21144 ("bpftool, selftests/bpf: Embed object file inside skeleton")
> > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
> > ---
> >  tools/bpf/bpftool/gen.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
> > index 7678af364793..8f76d8d9996c 100644
> > --- a/tools/bpf/bpftool/gen.c
> > +++ b/tools/bpf/bpftool/gen.c
> > @@ -1171,7 +1171,7 @@ static int do_skeleton(int argc, char **argv)
> >                 static inline void                                          \n\
> >                 %1$s__detach(struct %1$s *obj)                              \n\
> >                 {                                                           \n\
> > -                       return bpf_object__detach_skeleton(obj->skeleton);  \n\
> > +                       bpf_object__detach_skeleton(obj->skeleton);         \n\
>
> It's not incorrect to return the result of void-returning function in
> another void-returning function. C compiler allows this and we rely on
> this property very explicitly in macros like BPF_PROG and BPF_KPROBE.
> So if anything, it's not a fix, at best improvement, but even then
> quite optional.

Right, the C compiler allows it.
I won't change it.

-- 
Regards
Yafang



[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