Message ID | 1524101646-6544-4-git-send-email-leo.yan@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp88579ljf; Wed, 18 Apr 2018 18:35:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/71xGgsUYAON4o9VUERXRSPFpm8Uq/Gylbybxc+nXW2WIBpzAIWqSm/nTwR8S4Hsy0d6u+ X-Received: by 2002:a17:902:8601:: with SMTP id f1-v6mr4035005plo.220.1524101725284; Wed, 18 Apr 2018 18:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524101725; cv=none; d=google.com; s=arc-20160816; b=RcpxPt9/KlD23i3xv9mhwZ2zZhdowtEmhC8Oi6q8t7R7xYSTmO+uCqRHZUULbooGTy +S2Z4xIXSSozBZfp1mbjCb6wXltYMmCLW0VjyLSPimbVU472/obVZXE6+nefkAP6lvWZ 41Gke/atGgvY2WVe9pPNDRD4/jeycOG7YCrQkjaVtchUlWgdYC2bOGe8fiRpQAprOfYv PwU2qrq4ZYIleDg8CeBFpA7wrjMbC5sGAurotzdUcH3Thz8j2XlBcsirXO7sdGAlcrwz B6tpKtPuqB/fdWEjyCa7+F9BnPENtLHD4b2pPWhaCfJU1+E/1J/x7p7x/q1wYw1qct4f dAJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=bTeOv4ZbemmKNwy5sel+mHx//WZci0eMoeuPCgl8/r4=; b=qG2+R9g1n1ahuwV1UHbkQAtng4Cm8OPJ1/M6uTgIpdxIlBJTjnOEshbucYwtM/YdsU DJcc9x6tiLLGVSQxBRmO1zMatOrJJF36gUOf7g5oDiqZlEo52IML7AbxgvNWB/uMDsIF MvJdXhenoap4NSMetFZQZyMjaDzfkTogZbxhmaR00OiY8TL1JI9LT01q7a+Sd81LE0RK phAXNGES+YE+aPh2Plmr03Okhiq2rKdzRi71q9xvZaUCQQTM3Ff0PohIbCPI8JQYqept iK+eZ1JcEU+T8N6gFEwLoFgdpfd4f4hcypTWrpogOjWU5G/HwjnOZgOeJmiWieE/lQ9Z AreA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PaWzhRWB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si2088674pgt.575.2018.04.18.18.35.25; Wed, 18 Apr 2018 18:35:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PaWzhRWB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753420AbeDSBfW (ORCPT <rfc822;ramon.fried@linaro.org> + 29 others); Wed, 18 Apr 2018 21:35:22 -0400 Received: from mail-ot0-f195.google.com ([74.125.82.195]:43204 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753131AbeDSBed (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 18 Apr 2018 21:34:33 -0400 Received: by mail-ot0-f195.google.com with SMTP id d9-v6so4106197oth.10 for <linux-kernel@vger.kernel.org>; Wed, 18 Apr 2018 18:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bTeOv4ZbemmKNwy5sel+mHx//WZci0eMoeuPCgl8/r4=; b=PaWzhRWByuSB7Dg8cFgLt2fgfktHbSr/64MustDqkIIJChQhfJ+4Jn6tW2+M2qEGx+ NYwTnxtSdMu80cxgyoQHTBvj2krXy8ymf5smIx+e2VhINEpqz+3stVunQApXotCKEMHK s0ZumkMdLUkELa1i61+PHkF8lF4lzOQbEnnGY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bTeOv4ZbemmKNwy5sel+mHx//WZci0eMoeuPCgl8/r4=; b=hCebnJz/VqjAJgLWWGAswOmYSLbVRE1uPiWX26xpzpbOi88tCabEIE8tUDEfjb81VH f34fS2i22U3dRhNdx1Oh4eMoZhjtG7FPIFfFo2h5poRKyGo7PkDiy42TIttZCrQCVGv/ Ec8BFh8Ju5nvrIR7azk/ROLbzwwrLOZ0zxvk02f3ROvrRyVxHNW8UkpJ6BOWdAKhyQV1 0SgM3NBYEAa/j/hLsFIdEa8uAIxl4Z8rHhqdzsSsd52be8JzIlI5cUcN7iwN1Ffx91xP WPJVWbThW6VPftuPJ2GvFZ1FuF4VzqUa3BLBHh8wpg51uuFNaomArvjpUdouXEdy2roU DufA== X-Gm-Message-State: ALQs6tCWM1SK1dRawcOfnsn4qWz5QfN8/Fd39LKz0eQAHhpty+qImW6S c4pmlmjqS2EQmYK5Cex3LP5GjA== X-Received: by 2002:a9d:4442:: with SMTP id f2-v6mr2884237otj.319.1524101673003; Wed, 18 Apr 2018 18:34:33 -0700 (PDT) Received: from localhost.localdomain (li973-238.members.linode.com. [45.33.19.238]) by smtp.gmail.com with ESMTPSA id m84-v6sm1389662oia.1.2018.04.18.18.34.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Apr 2018 18:34:32 -0700 (PDT) From: Leo Yan <leo.yan@linaro.org> To: Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan <leo.yan@linaro.org> Subject: [PATCH bpf-next 3/5] samples/bpf: Use NULL for failed to find symbol Date: Thu, 19 Apr 2018 09:34:04 +0800 Message-Id: <1524101646-6544-4-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524101646-6544-1-git-send-email-leo.yan@linaro.org> References: <1524101646-6544-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
samples/bpf: Minor fixes and cleanup
|
expand
|
diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c index c2bf7ca..0c0584f 100644 --- a/samples/bpf/bpf_load.c +++ b/samples/bpf/bpf_load.c @@ -726,7 +726,7 @@ struct ksym *ksym_search(long key) /* valid ksym */ return &syms[start - 1]; - /* out of range. return _stext */ - return &syms[0]; + /* out of range. return NULL */ + return NULL; }
Function ksym_search() is used to parse address and return the symbol structure, when the address is out of range for kernel symbols it returns the symbol structure of kernel '_stext' entry; this introduces confusion and it misses the chance to intuitively tell the address is out of range. This commit changes to use NULL pointer for failed to find symbol, user functions need to check the pointer is NULL and get to know the address has no corresponding kernel symbol for it. Signed-off-by: Leo Yan <leo.yan@linaro.org> --- samples/bpf/bpf_load.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.9.1