Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp648029ybk; Fri, 15 May 2020 09:55:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVk4wHK7Eq9PxjV0gz4uHKsNdcGcvCsmCDevdn2bMV717dCvBVWvQ9GQ23bS7ebRzJybU+ X-Received: by 2002:a50:9dcd:: with SMTP id l13mr3874332edk.126.1589561737227; Fri, 15 May 2020 09:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589561737; cv=none; d=google.com; s=arc-20160816; b=IWhiGZ+99+xECvWkfZRSnnfddFWYtea6ycpsCbdpnoKIrAjU5WFGq9jEe96PFghYEA aPuJ4cPA80FU8F3uuX1LhUlZ6uPjIlbOVRTXwoT3GCf+G+bsCVApWvCkQ87PqptnPRTE rw0lNlnEKMKFq28EcYycXk+b38h8UNDiwaek7Agwhcb/pH4vBBjtEjmo1t8Tot8MOae6 SO5gJYvTFB2bKGmdKJS3LgqX5eBG+KYRM5qIYVeSxfdYqXh09W9uOTELqFdO/n8AJH2q 8KqIXOvHT8HkRNNeprLc0WUA8ePhcudwA69ZLH+KWT2G/yKkGHbtMNp0uHWNTSMGBIRw Yr0Q== 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:from :subject:references:mime-version:message-id:in-reply-to:date :dkim-signature; bh=BlBgjK5xziAM5vwiVDuTtOoE4PbK5TxWadJH4JBlKYM=; b=1Irn0GaG1kJF75XeKFkRyfPQhSGV00/c1sNzwgl86I2qHjKXpxzLdWJEVhC75Klfob Q6C5L6Xe4TkmQK6EzHUiic0uXzBNNgoH8TWe7YlN6KHhudPZM9GbN1zYV23YfqT/abjD qn5H9fuymZeSEv518tG5hifLRtsnXRpFsI76fyoSqGE9ub/Jz7W22itAOlxOx8x4UQGP BocB6YXOIcJeiJdVVt+vDmHCHwnzZhlSvBfOcmJeYdTGB/wBFTNWEZXO/lOSISlT4k97 IRQhBIEgyeea7q/AvBcamMhy2Bd6eSPTcSC3Q3ncyXmUt4i/dYc6eaEySn2W9nfpdGEO BL/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uwjR9RDm; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si1443791eja.255.2020.05.15.09.55.14; Fri, 15 May 2020 09:55:37 -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=@google.com header.s=20161025 header.b=uwjR9RDm; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726889AbgEOQuu (ORCPT + 99 others); Fri, 15 May 2020 12:50:50 -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-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