Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3088341rwb; Mon, 15 Aug 2022 17:50:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR5sZwjDNRh7kl+ieSLFmhUWTvCSkoi5wa62QOBcUuUndL/P6WJIRZ0AXonCgUf9cctSqfZK X-Received: by 2002:a17:907:72cf:b0:730:8bea:f741 with SMTP id du15-20020a17090772cf00b007308beaf741mr12105305ejc.527.1660611040190; Mon, 15 Aug 2022 17:50:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611040; cv=none; d=google.com; s=arc-20160816; b=IEtk0ui0WdkyR1g1WQ8OFYabYKDzCqwHkHYfyfsZvJMqoPEKqVyXhv3n5+wpk2LlaF 5PC2H9q9zsuadG0C3qLEM4/NoAZS9fKXQrz+TN8+Ji4BaNAzS1AAYE9wXl4kaNgOs2zj EXEps0UfsHR7ZPrfs3FiRDt2XFLl2FRQHP7YRxUn+CSODYuHFnLF8mMz1XfFh2DfKJH8 x4SIRN2kp5SI9c9m70upv7aa3uiHkyTVwKq7Uio/96oPSKIE4ueo5FN+HsZmp6A2dfdK CQ9pFj4Zg8QXWxIcjsw6Cxf93R5MV2jmfCCM13jC/yo/APk3nzBl3NVcJ/tYvkr9KM2C RuJQ== 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=pePya+on2SjhXFvv8hXPc1kaH4CZFQ+eoPBu1/ZaPoM=; b=m5w5lUg9QZK5yqwjHFJuzgYX1CdRTy1pHQRMh9Q4j70EGDZEQHfDmTUAMa5DLQeWwx A/T6NYRlQ2hgSYe5u/lW0e6Oc8HU32/0l5CjLQcYIoAU+bJgsJvtMaUdNgN8aU6yaUMI SAVMLUccCzPcA98ILLIFzJvlf/jhp0WEG5Oh5J9hsTin+DMIHLvcBNqfPUSUzVK+3qZ1 xSx8+jWOjFKABY0Ue+8uS32MFOxgq3ZNGR1UlEWVhc6WHYBY3b/7LnuK2XBYi3h3SmAr 7j07FzIAzSfuHHfnG4nwctdr8itHCyttJ2RhIS2qXJPy407g20ihXV7PIJh0tvnSnSE1 ODoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KlBFdAEm; 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 h15-20020a05640250cf00b0043bee43477csi9055266edb.576.2022.08.15.17.50.15; Mon, 15 Aug 2022 17:50:40 -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=KlBFdAEm; 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 S1355535AbiHPAAx (ORCPT + 99 others); Mon, 15 Aug 2022 20:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355972AbiHOXx0 (ORCPT ); Mon, 15 Aug 2022 19:53:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4906D15BBB7; Mon, 15 Aug 2022 13:18:09 -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 ams.source.kernel.org (Postfix) with ESMTPS id 9768BB80EA8; Mon, 15 Aug 2022 20:18:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFB55C433C1; Mon, 15 Aug 2022 20:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594680; bh=twaGXF0MvgZEXkpoKJrkeQCigkqeCs2jGuviee0Fe20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlBFdAEmb/KviagQE9qBjAub9kaY6CPDpQsQyY21Aw4/x7cS5VLOAyAc5Pf0mpLI+ fiD15xv4ER77M65Nc3ynEfEnEkFWelJ0kFEJYM/2LjDMWvMh5caTcqg4VVuyM3nKhJ X4eio71mKfQOa3sYivzg/5XsLye0szzLS+Gv+Wfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Daniel Borkmann , Martin KaFai Lau , Alan Maguire , Sasha Levin Subject: [PATCH 5.19 0525/1157] libbpf: Fix str_has_sfx()s return value Date: Mon, 15 Aug 2022 19:58:01 +0200 Message-Id: <20220815180500.671777579@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: Dan Carpenter [ Upstream commit 14229b8153a3ca51d97a22a18c68deeae64afce0 ] The return from strcmp() is inverted so it wrongly returns true instead of false and vice versa. Fixes: a1c9d61b19cb ("libbpf: Improve library identification for uprobe binary path resolution") Signed-off-by: Dan Carpenter Signed-off-by: Daniel Borkmann Acked-by: Martin KaFai Lau Cc: Alan Maguire Link: https://lore.kernel.org/bpf/YtZ+/dAA195d99ak@kili Signed-off-by: Sasha Levin --- tools/lib/bpf/libbpf_internal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h index ef5d975078e5..230ac5699c3d 100644 --- a/tools/lib/bpf/libbpf_internal.h +++ b/tools/lib/bpf/libbpf_internal.h @@ -109,9 +109,9 @@ static inline bool str_has_sfx(const char *str, const char *sfx) size_t str_len = strlen(str); size_t sfx_len = strlen(sfx); - if (sfx_len <= str_len) - return strcmp(str + str_len - sfx_len, sfx); - return false; + if (sfx_len > str_len) + return false; + return strcmp(str + str_len - sfx_len, sfx) == 0; } /* Symbol versioning is different between static and shared library. -- 2.35.1