Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3088201rwb; Mon, 15 Aug 2022 17:50:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR7yRjRSFy5Ukp9yhWo5qUx6zhyyMxN3E7Os7Bj3Y1KJg3EmjBH3GJ2eTgyHIx2xbhtWnN+N X-Received: by 2002:a05:6402:c43:b0:442:fa63:bee0 with SMTP id cs3-20020a0564020c4300b00442fa63bee0mr16750896edb.422.1660611029594; Mon, 15 Aug 2022 17:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611029; cv=none; d=google.com; s=arc-20160816; b=BrSObnYy2of8mnm5haXyx371nXniuGSuK6SzR+996EQ2cBcpZguysfT6txSUSY0idD g4WiWiJrhTA0RZbe00MKi1xDbB1+aeazx32MJ/DccvVvw83nIhT8F/YToACrN+aGPPBi +FX3QJGpW+ps3Vb3jQoHvpHpuHbTWGmkUB854Da5CXdMo+M0/CpVobqBkcmUXcgu5h7E XrC8Exhp08X/p+Gag/YEif6SokApbzWYPyhXupTfi5DmEY+wKZZ7pWbB7iNiQgWhe2Dq JJ62wgkHXSm0NWDrU4pMSRdqpGImBFlwvarHiupixnDLPOw5dQ8ThLjm2ZkZIqhOHBYl Hdgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EON1ZK5P6MFFLvboCm0Dd3QO4pKeYp/Y8zsU+iT/+Tw=; b=u/Mr5jNiIkuJ/HeTgz5EBVLpbdNndrSE3podm9xHOGh2nX2MWMHGXEr4fl77qkH/vW JP8NhFhekAbSPPgOUgyV8Da3jlNln7mwNeBKK9MMhZAbxPIQ7YlAdqUQAohuhXXPNP1g hyhTg3I2h2zDBxnQ1h6V4mBhGfp9+1KnwQtCFu+gVDxS1dYxVjRZgia0Mh6f7SsqNSUB C+dLTe0QQxynJsa0VCPWf3Hkybn+vKsPoz94KOLyc02bend5Sxc20Yi2GMAkS7BraKRw r8ulKxFmcXIdlDTJx+K8di+ln3PA3mJLIK+B2qW5gdGyyl3spY/ObNgwePu/UGpJviQk xW4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="L1UiYf/c"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ej27-20020a056402369b00b00443b1e53479si3782651edb.374.2022.08.15.17.50.04; Mon, 15 Aug 2022 17:50:29 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="L1UiYf/c"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242251AbiHOXXz (ORCPT + 99 others); Mon, 15 Aug 2022 19:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343749AbiHOXTA (ORCPT ); Mon, 15 Aug 2022 19:19:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F08CF7D787; Mon, 15 Aug 2022 13:03:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 20794612B9; Mon, 15 Aug 2022 20:03:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 283F7C433D6; Mon, 15 Aug 2022 20:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593831; bh=uMjdYRG3+VDQk8IKRHWN1MhbaHv9EFFvW0HrKc874qQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1UiYf/cImZ7QYP3S7ngqpxpbNfJwJeTkgZ697HCzQ2543qlevw0XGoMM/Oeep2wA Y3S6tzeIiP0ONDnwC0FCTPuLYxYm/BMtUjiI/lLPR9OWiPTzAD3QhLuUeMbacdkAte EthCUzhCPIy+0v71XxHFxA/ZAWg291MvMjh31iQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yuze Chi , Ian Rogers , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.19 0332/1157] libbpf: Fix is_pow_of_2 Date: Mon, 15 Aug 2022 19:54:48 +0200 Message-Id: <20220815180452.942992530@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 From: Yuze Chi [ Upstream commit 611edf1bacc51355ccb497915695db7f869cb382 ] Move the correct definition from linker.c into libbpf_internal.h. Fixes: 0087a681fa8c ("libbpf: Automatically fix up BPF_MAP_TYPE_RINGBUF size, if necessary") Reported-by: Yuze Chi Signed-off-by: Yuze Chi Signed-off-by: Ian Rogers Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220603055156.2830463-1-irogers@google.com Signed-off-by: Sasha Levin --- tools/lib/bpf/libbpf.c | 5 ----- tools/lib/bpf/libbpf_internal.h | 5 +++++ tools/lib/bpf/linker.c | 5 ----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index e89cc9c885b3..526bd6cd84a0 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -4943,11 +4943,6 @@ bpf_object__populate_internal_map(struct bpf_object *obj, struct bpf_map *map) static void bpf_map__destroy(struct bpf_map *map); -static bool is_pow_of_2(size_t x) -{ - return x && (x & (x - 1)); -} - static size_t adjust_ringbuf_sz(size_t sz) { __u32 page_sz = sysconf(_SC_PAGE_SIZE); diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h index 4abdbe2fea9d..ef5d975078e5 100644 --- a/tools/lib/bpf/libbpf_internal.h +++ b/tools/lib/bpf/libbpf_internal.h @@ -580,4 +580,9 @@ struct bpf_link * usdt_manager_attach_usdt(struct usdt_manager *man, const char *usdt_provider, const char *usdt_name, __u64 usdt_cookie); +static inline bool is_pow_of_2(size_t x) +{ + return x && (x & (x - 1)) == 0; +} + #endif /* __LIBBPF_LIBBPF_INTERNAL_H */ diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c index 9aa016fb55aa..85c0fddf55d1 100644 --- a/tools/lib/bpf/linker.c +++ b/tools/lib/bpf/linker.c @@ -697,11 +697,6 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename, return err; } -static bool is_pow_of_2(size_t x) -{ - return x && (x & (x - 1)) == 0; -} - static int linker_sanity_check_elf(struct src_obj *obj) { struct src_sec *sec; -- 2.35.1