From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0593DC433E0 for ; Fri, 15 May 2020 16:50:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D40A8206C0 for ; Fri, 15 May 2020 16:50:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uwjR9RDm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726908AbgEOQuv (ORCPT ); Fri, 15 May 2020 12:50:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726557AbgEOQuT (ORCPT ); Fri, 15 May 2020 12:50:19 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B33B6C05BD0C for ; Fri, 15 May 2020 09:50:18 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id n77so3281634ybf.2 for ; Fri, 15 May 2020 09:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc:content-transfer-encoding; bh=BlBgjK5xziAM5vwiVDuTtOoE4PbK5TxWadJH4JBlKYM=; b=uwjR9RDmlKmjmScHj3v7Ni5ICzuU//nG6viIyAoAF/WkjBrWDIARVrcYd7aEu8mHOq cNl9et0QdfJz+zPaPLpyymL5L7phhW0iMu5HrtI05joIngtoKv05HP/dSZ5NmfWwLYxY O2Zkkem36vWYls2D49elB9STe2MbzOJRZ72i1jM+ioGkVCtqvJd4K3PXvhb3N1usK0b3 f9xg+VxC8fEqgM3rDXEx2mqpfRdkXxVf8LdL8Md7vCG66TIfYwRPYq3znv0sv3tZXs+v Z7g/XVFAbGKcqoFK3I33p7T4Fwxt1ISxUpT0Qt23vOU1gRxqIrmpvdVcpc2Rh2U5biYx Oeqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc:content-transfer-encoding; bh=BlBgjK5xziAM5vwiVDuTtOoE4PbK5TxWadJH4JBlKYM=; b=gkvoay42xLoWs0bBxBBhYMfXmpPHuQa2fWYtouhpWkkjKfyFzjEc1d2Y6lFWzyaoVW RIgwnMiV3BeSBIqrCXXzuVVWiHpJ/dQjfL5CEpwwRrvZL/c1mesF/AiW+nVwH4bumIdX fHCcbbmTUhzO92OzuKv6+AbHWOeASz6G1zOPm9AGIXIG/pRf73Yqj74XVnZECCUOBhty 9dOrr2kx+mdEC2fzyc2DkfMfQOyAZm7j99/MjnHFsBFzPDx3ht/HrzbZlo5bs+SwSKvv pQo/YU0HUtfZP9+umTRDo/05cefqGspuETu54BwjIKViV43Q9hDZ2ytlZDULcgkdPRdt 2+PA== X-Gm-Message-State: AOAM531UImfKoozA/tewPdO3Kl8PiB4j/ikKcaekac0KFkExva+zhcpO ldPiRMHae0Z8pW9vvDnYdoOK2QxfBJBI X-Google-Smtp-Source: ABdhPJzrDFvQNIcFMi0Solen5ZfhZvieWElQgZDit3xL+BENKdhSdyY5DiSL/W90JbqHijIdRCyezZEgBUmU X-Received: by 2002:a5b:7c8:: with SMTP id t8mr6515278ybq.223.1589561417932; Fri, 15 May 2020 09:50:17 -0700 (PDT) Date: Fri, 15 May 2020 09:50:03 -0700 In-Reply-To: <20200515165007.217120-1-irogers@google.com> Message-Id: <20200515165007.217120-4-irogers@google.com> Mime-Version: 1.0 References: <20200515165007.217120-1-irogers@google.com> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog Subject: [PATCH v2 3/7] libbpf hashmap: Fix signedness warnings From: Ian Rogers To: 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 , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: Stephane Eranian , Ian Rogers 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 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 sig= nedness: =E2=80=98int=E2=80=99 and =E2=80=98size_t=E2=80=99 {aka =E2=80=98l= ong 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 sig= nedness: =E2=80=98int=E2=80=99 and =E2=80=98size_t=E2=80=99 {aka =E2=80=98l= ong unsigned int=E2=80=99} [-Werror=3Dsign-compare] 150 | for (bkt =3D 0; bkt < map->cap; bkt++) \ Signed-off-by: Ian Rogers --- 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; =20 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; =20 new_cap_bits =3D map->cap_bits + 1; if (new_cap_bits < HASHMAP_MIN_CAP_BITS) --=20 2.26.2.761.g0e0b3e54be-goog