Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp510191pxu; Tue, 1 Dec 2020 17:42:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJznOmg6cuCfhBl8A28NJQbxn0womzp6Rugic7HgdfyeYBqHG7v2VDDb6D/mYJZJOSp1g88d X-Received: by 2002:a50:d757:: with SMTP id i23mr441992edj.116.1606873368387; Tue, 01 Dec 2020 17:42:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606873368; cv=none; d=google.com; s=arc-20160816; b=soAxgDjFSm5MtpNpQGrNVbu60u/ouDlgM7yALTO6jSHNwBS8sHALT+7hpsItVrULzD ajif+DuXMIO/4TtC0gURmkMt/zGYJzGXMWzRi1U+2F7MtM5masScqtvcwlwOkqDW1P1C 8fjZV1A9ZDkIrFaCXYL6OyUgjDfHhK89aE7nAdH6i96byoDs9dPElr8e2EKpXrF8sIoz nG8TwebQV0oOqxxRDYL5HJEZ/TtBCPpEt9EJQc9Hsurp9G88RfaVNY5DgVJk6VFj2M21 xqVGk17ckFZS73apLr6bWS1QQvkoioyrhUK5ZYzZXEa+TlN02yvQSUeMSxWD1tLYfkb1 GOgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=k0tPoBlU4NKyR6gcj3vy9nGS+9uhhqNqZLS5gO66TK0=; b=nh6wb9Dk3Kud/7N5RItH3BWqoOeYiKTJlzqDr4mdaSCn7rLVn8e0yA6aN15nH13JAp nRB7H4Dw5XGgoEh3/ZcNYGyH7x9srCA2TsRPOm1fyUkOgqhxvZmyZ6k5oEcxxReyZEFP VLusxa91+e3Ix9nGXhgaMNgDNk8zecMzHNQAsqRHLWpT9yErZTqEeqoXRg+CT4J2lDgO /PrRo8EyuVf4NHN/NA+MDriAv5XYs0OyKs2Am7NNA7za3BniYnsvwV1v2XT1kS+oVcYf G3EVeqeYyOSD0bz3f1ZAoJUSx8oeBHogKBg925GxK4+AKpQ22XfYMD7YUP/YZhQ7MVXA x4Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W8z9s7y0; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si1054959eje.325.2020.12.01.17.42.25; Tue, 01 Dec 2020 17:42:48 -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=@gmail.com header.s=20161025 header.b=W8z9s7y0; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727960AbgLBBjJ (ORCPT + 99 others); Tue, 1 Dec 2020 20:39:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727660AbgLBBjJ (ORCPT ); Tue, 1 Dec 2020 20:39:09 -0500 Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2080EC0613D4; Tue, 1 Dec 2020 17:38:29 -0800 (PST) Received: by mail-yb1-xb42.google.com with SMTP id s8so125713yba.13; Tue, 01 Dec 2020 17:38:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=k0tPoBlU4NKyR6gcj3vy9nGS+9uhhqNqZLS5gO66TK0=; b=W8z9s7y0Ua26sqELm+h84HFNCk1fsBqzDiglnalhsMtYstzFt55bJ17IxbHXTX7+Kq B9q9NLbVB8WRAd9f4Go49EwJBs6YUyHtjWhZUXrwODxAUOUqAMr1MEmI5GeSgyxKqiVZ d1uqSQJIVifxysC3KEKM9MavXJOK0y2xFuJ1TLkWGDhaBervLJZATW3vhcNcV/idtCYO TEf4v7GKcP25LVw8K3eO4Z9nKkc1K+5m1rsSZMmBNKfjPlADDwe1bxmur9yvATVQjE1Q tjhn49s7nC/obLXny/wfi5uYC8jh1ZFp/FcoL/bxMd7wVDzDQCpBtu8HJIC6PDjWvEk0 QQ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=k0tPoBlU4NKyR6gcj3vy9nGS+9uhhqNqZLS5gO66TK0=; b=GrhxSptPhvlmQ96XWGl953v0d+dZxbVohT/918QMArQvYmimpAmCn+5Hdf50sihZdP gIQRRB1Bn/hyW3IRxdNBfiyDTI2ZGz9ghbl4OYQ9r+eQ3fMompReq83EJMUIC9r6vUm5 puz4TB5nppGw0mHn4Nq9GqpNNtDO9BSNsJHXo3HneRfKCR8b1wPUODQXEKHcy/yZuXBd //m7O0ne2H23+VACBpixdGLghhwA/gAuWnmuzfYv45DqfU/0WPNpEvzaJCTFeIjOcHqu CLJZ34qNwRZb/D51qK9Sc+9Zc2HocHAh1J/GE+o5mPcUTcdMw8FJmPQSLmgfInT2/qUF 3t7A== X-Gm-Message-State: AOAM533fgCKJsALvKihtaXLKEynFhosDLJct7qjTWzdm3/EhzrbZ/Je1 C5RNGOQs7g7JUZkx6dtCn4JkLO86k0fYe73C//M= X-Received: by 2002:a25:585:: with SMTP id 127mr240609ybf.425.1606873108487; Tue, 01 Dec 2020 17:38:28 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrii Nakryiko Date: Tue, 1 Dec 2020 17:38:17 -0800 Message-ID: Subject: Re: [PATCH] tools/bpf: Return the appropriate error value To: =?UTF-8?B?5b2t5rWpKFJpY2hhcmQp?= Cc: "ast@kernel.org" , "daniel@iogearbox.net" , "bpf@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 30, 2020 at 7:06 PM =E5=BD=AD=E6=B5=A9(Richard) wrote: > > Compile times error: > "Error: failed to load BTF from /mnt/linux/vmlinux: No such file or direc= tory". > This file "/mnt/linux/vmlinux" actually exists, but only because CONFIG_D= EBUG_INFO_BTF > is not configured with this error. > > Signed-off-by: Peng Hao > --- > tools/lib/bpf/btf.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c > index 231b07203e3d..228f508fbd04 100644 > --- a/tools/lib/bpf/btf.c > +++ b/tools/lib/bpf/btf.c > @@ -865,7 +865,7 @@ struct btf *btf__parse_elf(const char *path, struct b= tf_ext **btf_ext) > err =3D 0; > > if (!btf_data) { > - err =3D -ENOENT; > + err =3D -EPROTO; ENOENT as related to "no .BTF section found"... EPROTO would make sense as well, but I don't think we need to really change anything. "Protocol error" isn't very meaningful either... > goto done; > } > btf =3D btf__new(btf_data->d_buf, btf_data->d_size); > -- > 2.18.4