From patchwork Mon Aug 17 15:16:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 266267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86F83C433E1 for ; Mon, 17 Aug 2020 18:05:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6424A20758 for ; Mon, 17 Aug 2020 18:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597687543; bh=rjF2FCv8YBcLcgHOazBalU9zhULGooI14SzRWQnIjP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=akP7eelUZ4u4HLZ21RfuN5G1mlU9PK+V78qs4e6PCCUMkJeyAo7VfD8klRaAyEgCh FtkVowX2f5ffFskqxAQVFC6BYeeOQAzH6dV4PZtM6K6PI8PwEBXetXnm1pjUd3KprQ dt5p1WcuJH8FiQiZE1gFmCUX3t68K9G8YO+i9jUM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390265AbgHQSFl (ORCPT ); Mon, 17 Aug 2020 14:05:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:59524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388490AbgHQQJE (ORCPT ); Mon, 17 Aug 2020 12:09:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9A2E222B47; Mon, 17 Aug 2020 16:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680543; bh=rjF2FCv8YBcLcgHOazBalU9zhULGooI14SzRWQnIjP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AQT/oBKqfJUwkHacSDZ5HAZmKeMHG+Ohhq6JUBTERKjZidh4wJrL0LmwRb+ZQjAiA laOnRENJmLRzsmixGfzei+WACe/mhxgYzVhg6y9M5sgP1n0FI/is/yG1kFUcBvsIAH jKzbGhrkE8HtH0BtOPrFTX/khRFyzmLrS2feXdnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianjia Zhang , Daniel Borkmann , Tobias Klauser , Andrii Nakryiko , John Fastabend , Sasha Levin Subject: [PATCH 5.4 198/270] tools, bpftool: Fix wrong return value in do_dump() Date: Mon, 17 Aug 2020 17:16:39 +0200 Message-Id: <20200817143805.650741245@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tianjia Zhang [ Upstream commit 041549b7b2c7811ec40e705c439211f00ade2dda ] In case of btf_id does not exist, a negative error code -ENOENT should be returned. Fixes: c93cc69004df3 ("bpftool: add ability to dump BTF types") Signed-off-by: Tianjia Zhang Signed-off-by: Daniel Borkmann Reviewed-by: Tobias Klauser Acked-by: Andrii Nakryiko Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20200802111540.5384-1-tianjia.zhang@linux.alibaba.com Signed-off-by: Sasha Levin --- tools/bpf/bpftool/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c index 9a9376d1d3df2..66765f970bc51 100644 --- a/tools/bpf/bpftool/btf.c +++ b/tools/bpf/bpftool/btf.c @@ -510,7 +510,7 @@ static int do_dump(int argc, char **argv) goto done; } if (!btf) { - err = ENOENT; + err = -ENOENT; p_err("can't find btf with ID (%u)", btf_id); goto done; }