Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3628258pxb; Mon, 24 Jan 2022 13:54:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2WbWr/YLjX3Pii7yuO5zwtYhbVif8JCr/EUgjJ6VseX+e/rtGBAix1Q1pOMmQBXCwOCO7 X-Received: by 2002:a17:902:a9ca:b0:14b:650c:cc44 with SMTP id b10-20020a170902a9ca00b0014b650ccc44mr2979326plr.76.1643061241532; Mon, 24 Jan 2022 13:54:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061241; cv=none; d=google.com; s=arc-20160816; b=G8MwsjRAipzcLd2WKCP3eMPQnOD9NPKYL19Z0bOfLNaIbb9Vv7yTKHULVF4E/fwygZ SwN42KbPtc4R+dpCM7/qUTA9ZW76tVREla1G5Z7z/ZHAxJ1oFeUz0mhL5Dr/IWg7GjMY 1FZigA7zFO/3sLFmgkw2cAE5I0UNjfyptwS6sg54bXwhjH1A6hY+65wuH+x1pX5mGDJ1 c+u+LKajxoPJapIPye7RwMJFtZxDcj5T6c9SbfCEQmQga3XdRPsMKK68tOP3ChLdAgOh eFHAbysIa+jgmAt9wrN/sVQuLxP1tjBmPKF+h3xe6i1v0LpIrSEFd4C2WQCSq3zeDw3Q a6LQ== 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=2F7zGGS6C7T1aE2WIqxgG15kBNdHKKkn9WszkQY0cO8=; b=YTTnqF4Qw0GFilhzxO7OvKSszHdkj0y20UhY6Wv05BZEJasGQoz2e8+RCsdV0gNkh2 eqsJxCYpGI4vo5KtYhT+UmENmxyFsy6IalFO0NpNS8p0/r1rCkneBd8/CBEilgJ1nujW 6XVWdHGvt4jc+cjhsrtixQacnPH/I02/8YTu13VoGQ/rdrytbgm/14OuPaTzBu0jFk2f lHOTMec5bjWF0GOKXlxPQRenQJB/du92SHoDPi8HOlWfhzCRtZ7D4h+1p7R33m5tSeEi 9HKcg3IQd8M5ehmfFVlj7sT8DdiaxY7ngMshiLXt/xA/4xsLQaixzfhoadLzyEn/xrh0 xlLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D9Y1WObE; 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 d8si1940471pfl.206.2022.01.24.13.53.49; Mon, 24 Jan 2022 13:54:01 -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=D9Y1WObE; 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 S1456158AbiAXVh4 (ORCPT + 99 others); Mon, 24 Jan 2022 16:37:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54438 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444979AbiAXVBu (ORCPT ); Mon, 24 Jan 2022 16:01:50 -0500 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 5122D60C17; Mon, 24 Jan 2022 21:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 314AFC340E5; Mon, 24 Jan 2022 21:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058109; bh=RCFUEYNF8zNosS4379XW1Pwb4Rx5S5veAVuWvZxUI2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9Y1WObEbu60uL+ms9Q57TeIsgGg/5orLASjVI8T0vsj+Utq58Z6cU1ViqemjWf3c QDXL51TY+xbGlAH9o56lF+GKMwruOw69hg3Q2JCZrY95/MsEqdY0W/dUD8+QUSalBY f80ceAgvkVpHEjmbcjwYarQ80r/PM9MPpURaNK6c= 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.16 0184/1039] libbpf: Silence uninitialized warning/error in btf_dump_dump_type_data Date: Mon, 24 Jan 2022 19:32:53 +0100 Message-Id: <20220124184131.467285436@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 17db62b5002e8..5cae71600631b 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -2194,7 +2194,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