Re: [PATCH bpf-next] bpftool: Fix build error with -Werror=type-limits

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

 



On Tue, Aug 29, 2023 at 11:51 PM Quentin Monnet <quentin@xxxxxxxxxxxxx> wrote:
>
> On 29/08/2023 16:42, Yafang Shao wrote:
> > Quentin reported a build error as follows,
>
> Just a warning :)

Will reword it in the next version.

>
> >
> >     link.c: In function ‘perf_config_hw_cache_str’:
> >     link.c:86:18: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
> >        86 |         if ((id) >= 0 && (id) < ARRAY_SIZE(array))      \
> >           |                  ^~
> >     link.c:320:20: note: in expansion of macro ‘perf_event_name’
> >       320 |         hw_cache = perf_event_name(evsel__hw_cache, config & 0xff);
> >           |                    ^~~~~~~~~~~~~~~
> >     [... more of the same for the other calls to perf_event_name ...]
> >
> > He also pointed out the reason and the solution:
> >
> >   We're always passing unsigned, so it should be safe to drop the check on
> >   (id) >= 0.
> >
> > Fixes: 62b57e3ddd64 ("bpftool: Add perf event names")
> > Reported-by: Quentin Monnet <quentin@xxxxxxxxxxxxx>
> > Closes: https://lore.kernel.org/bpf/a35d9a2d-54a0-49ec-9ed1-8fcf1369d3cc@xxxxxxxxxxxxx
> > Suggested-by: Quentin Monnet <quentin@xxxxxxxxxxxxx>
> > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
>
> Thank you!
>
> Acked-by: Quentin Monnet <quentin@xxxxxxxxxxxxx>
>

Thanks for your review.

-- 
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