Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2207819iog; Sun, 19 Jun 2022 10:22:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tjEwqXwO3MmfIlh9rwXiCqJpBRm3pY+NP4cEaxWLNhuXKBpxHlTbIJECHOFDgi2d13CpAt X-Received: by 2002:a50:ef04:0:b0:435:6560:abba with SMTP id m4-20020a50ef04000000b004356560abbamr14598377eds.3.1655659328904; Sun, 19 Jun 2022 10:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655659328; cv=none; d=google.com; s=arc-20160816; b=AA6ddjXzKFh1YdPvqYM1gabZhk+yyYJQ0xfNUv+LvN6GmBzR+bdo9fssKIamGblSq5 SOEMRXfEzDOXNCbPqIN5FpitKJiKrFp7P335cQMAQcbGPu85WW9oGppGQh4CVrc4H/mY RA8a1bELIw+2/eUaWEjAsa/ZPBS5LR/9wpxlECvzi8qIi7BMygAbUZ84AivvB7/b4YG/ jZDGg7+57LnS8GNxcfLfl1fPnIKYxCcY4vpdmFDt/Eryjn/Wd9makj9R9QM+X4td/UdS qotN9s7uosuRpemaQFD0/sslhrM/BfC6FHkThU7NOv/iGRRmPWw3LrITRW9ve6JrQhO0 Eokw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=P3J9ORxIk3JkE/14W4JQ4YZVtwN4OsaFsPoDdcgxwfY=; b=XYjQrsBtKIHhwb644iXVANYneKft+QAbP0M6SHFeWilZ9HcHm3ImCeoLmnTbmibSKW tYF1BCV+KKN8E2upniWDFrIhLQxSHfwM36LgXOT/Qhb+OfzUAcTohXhWaDpKlhTpyaNH w0qRJbSissSvzb+xDUFQwwhz4IcWFIqD1ZKXMXU8Ulp4VLTm7bSvZEMNsRDmh5TSH4Nr BGjJjCahvLO1Qmk11/HtHfLdbjQ0d3dClNbCmZuKZ9+7z2fnAZTiz1tuWjPO/waEHVkA zSYuRCLwqRFwBHq0MBzHlFRrwGgY8vEHw2YEFtliF4im+WaWiGpaCjgqJUHBdOcIAHGS EnsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr13-20020a170907720d00b00710e9e0a239si11582433ejc.919.2022.06.19.10.21.42; Sun, 19 Jun 2022 10:22:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236799AbiFSRNC convert rfc822-to-8bit (ORCPT + 99 others); Sun, 19 Jun 2022 13:13:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232771AbiFSRM7 (ORCPT ); Sun, 19 Jun 2022 13:12:59 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D0C110BE; Sun, 19 Jun 2022 10:12:58 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 3E71D1C0B8F; Sun, 19 Jun 2022 19:12:57 +0200 (CEST) Date: Sun, 19 Jun 2022 19:12:48 +0200 From: Pavel Machek To: Ian Rogers Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Yuze Chi Subject: Re: [PATCH] libbpf: Fix is_pow_of_2 Message-ID: <20220619171248.GC3362@bug> References: <20220603041701.2799595-1-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20220603041701.2799595-1-irogers@google.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > From: Yuze Chi > > +++ b/tools/lib/bpf/libbpf.c > @@ -4956,7 +4956,7 @@ static void bpf_map__destroy(struct bpf_map *map); > > static bool is_pow_of_2(size_t x) > { > - return x && (x & (x - 1)); > + return x && !(x & (x - 1)); > } I'm pretty sure we have this test in macro in includes somewhere... should we use that instead? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html