Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3642361pxb; Mon, 24 Jan 2022 14:13:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyttAyHIQNh38/nW4KCCLe3eC7Rbj9LgOnhQfcsN09tgmJr3YvP2TujpbGHCRMkfND44z5U X-Received: by 2002:a17:903:2307:b0:14b:2e88:7efc with SMTP id d7-20020a170903230700b0014b2e887efcmr11933401plh.52.1643062409768; Mon, 24 Jan 2022 14:13:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062409; cv=none; d=google.com; s=arc-20160816; b=T1wmtqwUIXrSQBggdFlmnY+ZoVwf3EFPDmco/G5FlY2ka5fEAZBYj0hQcYNqq4i/7t eys7CNyAN66UooKKFR5zsuTCEJob74i2DflqIrP6u8/4wOtchHodzmzKLtQ5aQLbidC1 3R5ZVlb0jzA5xgMDkIxqT1vmDF+bXYm9weXhRyPWkBKwuDXusDSDv8cyj+neA9szpQT4 9ZTPMErDMWCcNnwOwK/ggbWZnQSvQCdmugqgbdH0xzAWAftECZqy+lIlahEU4MDCt0Dz MtyFUbt0bBRZZ5q+Qp2NPuKECQ2WnRgSH18pgintvR9uDOQ69GDNeSkaBd/IoOMfaSGn 8SmA== 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=yb8Mxr9tjPCQIZlcpOr9GZ+64bfGyzaocfaoRR8fBXY=; b=aTNHDf6gA0G3Mnn0gKj8Z3yQ5/SGy8bJO/2wkNERs2KozvuXb0muh+siNG4ENIkXl0 y56ErpyZ/tuhCWeakkQrEdItD7/NbfF8Td+9CKfqAm22O+81sNs5o3qr9Hd78FkbaPYu 460SmzDND01E/ipEZ6O6ao6JOZLpGJGN0Soj1lAMOTdqC8U4oaBmoKMJs43Et11Q9+lY 1LMhp3DbHHJbJRNE2k1afHp0W/OhRlkrJJxmxSquW0MnyZ4LYBe0rW9Rl2OD9fRkj+Q8 nLO6HeWUJ9q3FAE1vMChp9eveDcmeU92jnDfr+g4JBbiorPbDUKooBAi/F7Ztw/BQbPJ Y6Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EoVGbnpI; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b12si6917808plg.609.2022.01.24.14.13.15; Mon, 24 Jan 2022 14:13:29 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=EoVGbnpI; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577966AbiAXWBU (ORCPT + 99 others); Mon, 24 Jan 2022 17:01:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451574AbiAXVXI (ORCPT ); Mon, 24 Jan 2022 16:23:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15111C09B055; Mon, 24 Jan 2022 12:17:42 -0800 (PST) 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 B0808B812A7; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D231CC340E5; Mon, 24 Jan 2022 20:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055460; bh=wCk2AXJ9tvWhIi/cMIJbL4Pixx4R3mqFsXGZLo+5u3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EoVGbnpI/PSL89nW4gZflT0SBiv4ZjV5cgLbaWUEu1Faddtu2JQ9lmeY8XtsiGgEc aes+uH292qB/jLYQ+ZQMZgGRMo35h0vE1szrYQv6K1cdqQcQtC59aBvp63R+kq2NXH TUAD3HzJB4xd67zMpVzIAl+CeG7ext9kaJqGlmrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Maguire , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.15 159/846] libbpf: Silence uninitialized warning/error in btf_dump_dump_type_data Date: Mon, 24 Jan 2022 19:34:36 +0100 Message-Id: <20220124184106.471942756@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alan Maguire [ Upstream commit 43174f0d4597325cb91f1f1f55263eb6e6101036 ] When compiling libbpf with gcc 4.8.5, we see: CC staticobjs/btf_dump.o btf_dump.c: In function ‘btf_dump_dump_type_data.isra.24’: btf_dump.c:2296:5: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if (err < 0) ^ cc1: all warnings being treated as errors make: *** [staticobjs/btf_dump.o] Error 1 While gcc 4.8.5 is too old to build the upstream kernel, it's possible it could be used to build standalone libbpf which suffers from the same problem. Silence the error by initializing 'err' to 0. The warning/error seems to be a false positive since err is set early in the function. Regardless we shouldn't prevent libbpf from building for this. Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data") Signed-off-by: Alan Maguire Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/1638180040-8037-1-git-send-email-alan.maguire@oracle.com Signed-off-by: Sasha Levin --- tools/lib/bpf/btf_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index e4b483f15fb99..8c9325802793b 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -2186,7 +2186,7 @@ static int btf_dump_dump_type_data(struct btf_dump *d, __u8 bits_offset, __u8 bit_sz) { - int size, err; + int size, err = 0; size = btf_dump_type_data_check_overflow(d, t, id, data, bits_offset); if (size < 0) -- 2.34.1