[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbASksH9Ne7GVcdMSZRB_7nVwsr1Y4V66PfiCiK-fzQvg@mail.gmail.com>
Date: Fri, 15 May 2020 12:40:31 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Kajol Jain <kjain@...ux.ibm.com>,
Andi Kleen <ak@...ux.intel.com>,
John Garry <john.garry@...wei.com>,
Jin Yao <yao.jin@...ux.intel.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Kim Phillips <kim.phillips@....com>,
Adrian Hunter <adrian.hunter@...el.com>,
Leo Yan <leo.yan@...aro.org>,
open list <linux-kernel@...r.kernel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v2 3/7] libbpf hashmap: Fix signedness warnings
On Fri, May 15, 2020 at 9:51 AM Ian Rogers <irogers@...gle.com> wrote:
>
> Fixes the following warnings:
>
> hashmap.c: In function ‘hashmap__clear’:
> hashmap.h:150:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
> 150 | for (bkt = 0; bkt < map->cap; bkt++) \
>
> hashmap.c: In function ‘hashmap_grow’:
> hashmap.h:150:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
> 150 | for (bkt = 0; bkt < map->cap; bkt++) \
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
Acked-by: Andrii Nakryiko <andriin@...com>
> tools/lib/bpf/hashmap.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tools/lib/bpf/hashmap.c b/tools/lib/bpf/hashmap.c
> index cffb96202e0d..a405dad068f5 100644
> --- a/tools/lib/bpf/hashmap.c
> +++ b/tools/lib/bpf/hashmap.c
> @@ -60,7 +60,7 @@ struct hashmap *hashmap__new(hashmap_hash_fn hash_fn,
> void hashmap__clear(struct hashmap *map)
> {
> struct hashmap_entry *cur, *tmp;
> - int bkt;
> + size_t bkt;
>
> hashmap__for_each_entry_safe(map, cur, tmp, bkt) {
> free(cur);
> @@ -100,8 +100,7 @@ static int hashmap_grow(struct hashmap *map)
> struct hashmap_entry **new_buckets;
> struct hashmap_entry *cur, *tmp;
> size_t new_cap_bits, new_cap;
> - size_t h;
> - int bkt;
> + size_t h, bkt;
>
> new_cap_bits = map->cap_bits + 1;
> if (new_cap_bits < HASHMAP_MIN_CAP_BITS)
> --
> 2.26.2.761.g0e0b3e54be-goog
>
Powered by blists - more mailing lists