Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp757387ybk; Fri, 15 May 2020 12:42:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaGo0XMFlPjzW1PpPQg5ta+oIZnXlM8yM8WyZ0tnVVSJze83OxJcxVVrIBMky+ZpBv411b X-Received: by 2002:a50:ea87:: with SMTP id d7mr4224144edo.48.1589571759731; Fri, 15 May 2020 12:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589571759; cv=none; d=google.com; s=arc-20160816; b=G9hCVzt49F3zPB0RwCtRdPKEfVqgxuXEZ2GC9p3hmqe68Am74Xsog1jAKCX5BNQTxr 2aLaqGJwcKJ/8WwJYcNIs+UL++mVJToTyC5zvmjtXVA68O/tU1SBc2Enl4uR9Box7hrt lzarl5mnZyqlZ8yrmbyIlH2W+rl3cMezGOTkrxrv7eSYbW68/flCB49bLNVxFDHfnDNH O0YmYchJATiEh3k+Qdpr3MEzNtDDafcGfC/UoUoPyAzA5p+WBBj9ekdEqUzuVtqVxDS8 BgGacsnN8hBdhe+bHyeABJ9uzj64rDH4QjDIkD/X1ATH7C6vhT09GbS3l1UJ6BW3RfPk 2Dlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7ou8JV19REXcnpzqyrzp5r1aAUsTMKh8ZTeIZObEj0s=; b=qPRShhL1b7J6F1UJpPpWveHSH/rTs6L7rpdnhWfMPSAx4r2/MPnm8ggFu2YjnlSKiX OB8fHVwkq1FWo6DlCDIueBt4wlPtgn5+ZRf0sGeRQsGHfsLixitDg1YdcSVq318qHYPi weW1m5r96MpzdBGsGvng+3j0N0MQTsNqssM2OEtgmh7UVYlZQD3mf8W7Cfp+/dF7RhDY +KXAG08bbHd0xZZhF2ZJ4L89Xkx+7WG6SDnNxrYAHAvvElEzF/Z061/jjGR0xDCEy4ET DdxicqWgNeocDwaJ8QA2XmHYURHnz0Wbs/XfYHMy6LO6y9IaSDhrxBUpZWo80asJRUFY WnZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FNPXlXtp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q12si2015384edc.413.2020.05.15.12.42.16; Fri, 15 May 2020 12:42:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FNPXlXtp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726557AbgEOTko (ORCPT + 99 others); Fri, 15 May 2020 15:40:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726168AbgEOTko (ORCPT ); Fri, 15 May 2020 15:40:44 -0400 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 393E2C061A0C; Fri, 15 May 2020 12:40:43 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id d7so2975973qtn.11; Fri, 15 May 2020 12:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=7ou8JV19REXcnpzqyrzp5r1aAUsTMKh8ZTeIZObEj0s=; b=FNPXlXtplV8T8Z7258sH/+oLdanFfWXAst/oYMZKUgpXJ3FdyB27CjJht3ztm13skK sR6WgVGY5yVrg5e+IhA0oA1uXmozEfkW6PLQ6Hm6t8kMJ14OPXXYW3rZkjAT5f6nXNrP Xpyt28LohTOz0yIn6u/MUdQnfldPWZ4mJ7ti9jkInxt/1YBwX5nZ0q3E4DmSfZEH8ixW MjXaGqXj/tUf1sbpVcgWQcbN2juSdyvCoVt3PqX4LpgbMbw5ojLSVd8pggE2s55xpAmb YYyHAOhpvBqcM6dzH3v3hLIWJKQ1nSaFq+flNT8RN+RmBxibdno9fm3iJqEJ4hoBZQ0o xjeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=7ou8JV19REXcnpzqyrzp5r1aAUsTMKh8ZTeIZObEj0s=; b=Qwho5HUXtxA6QRjPmIfkANaji/dXbPXLObRHpNWpg+LmTPY/nIQjgiz6O8DAC7Gjev 8w/PBg7jb9AfgFKF20+d+tl5LNUPZLYaMxMQWK1xSjcXcRZInpqLsVWt2kP/VI8JDInt /jiORA0IUbm08QaI+XgwjbEo/bQ3rpq3ccfdSLwXU5XBOYxFSzpkpnSewWpGRg2KkYC+ nuDG1Pk3QNmIRq4mPrZZ6PbaEXJxCsHyJRvDShsIJaDCpyv+QsA5HEajbf0cHkt9KU3u lkA0lxvP7YTboR5ymn1l2zJr2WoMTVYZBLMSoGQDuhjmJGTxOvdpzPpzX3MX+jvq8R9V oFuw== X-Gm-Message-State: AOAM5323RVWpWgNI3dWSVkPjwWIvx2jNEnJuKUCbhz2Qnh5foGUEGUXx s4JY4aeZYenPJxpZP8W7KdSxFmdOoMjVsGV7VrA= X-Received: by 2002:ac8:1ae7:: with SMTP id h36mr5217245qtk.59.1589571642463; Fri, 15 May 2020 12:40:42 -0700 (PDT) MIME-Version: 1.0 References: <20200515165007.217120-1-irogers@google.com> <20200515165007.217120-4-irogers@google.com> In-Reply-To: <20200515165007.217120-4-irogers@google.com> From: Andrii Nakryiko Date: Fri, 15 May 2020 12:40:31 -0700 Message-ID: Subject: Re: [PATCH v2 3/7] libbpf hashmap: Fix signedness warnings To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Kajol Jain , Andi Kleen , John Garry , Jin Yao , Kan Liang , Cong Wang , Kim Phillips , Adrian Hunter , Leo Yan , open list , Networking , bpf , Stephane Eranian Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 15, 2020 at 9:51 AM Ian Rogers wrote: > > Fixes the following warnings: > > hashmap.c: In function =E2=80=98hashmap__clear=E2=80=99: > hashmap.h:150:20: error: comparison of integer expressions of different s= ignedness: =E2=80=98int=E2=80=99 and =E2=80=98size_t=E2=80=99 {aka =E2=80= =98long unsigned int=E2=80=99} [-Werror=3Dsign-compare] > 150 | for (bkt =3D 0; bkt < map->cap; bkt++) \ > > hashmap.c: In function =E2=80=98hashmap_grow=E2=80=99: > hashmap.h:150:20: error: comparison of integer expressions of different s= ignedness: =E2=80=98int=E2=80=99 and =E2=80=98size_t=E2=80=99 {aka =E2=80= =98long unsigned int=E2=80=99} [-Werror=3Dsign-compare] > 150 | for (bkt =3D 0; bkt < map->cap; bkt++) \ > > Signed-off-by: Ian Rogers > --- Acked-by: Andrii Nakryiko > 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 =3D map->cap_bits + 1; > if (new_cap_bits < HASHMAP_MIN_CAP_BITS) > -- > 2.26.2.761.g0e0b3e54be-goog >