Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1835290pxb; Fri, 6 Nov 2020 23:47:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4D4AHha5PcNp1BJ2c+G+wFK1qYKYQczGyhs17ICILEJl/8i3APSrOkcPRU2AafoUY74+I X-Received: by 2002:a05:6402:b68:: with SMTP id cb8mr5902878edb.198.1604735256830; Fri, 06 Nov 2020 23:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604735256; cv=none; d=google.com; s=arc-20160816; b=J97LACkkRfZDzZxjbAkE9fXR6uCw6pmL6tl5O7nodZ3/RQV/RYVK7n5z4gQMHawvNa C/+tK5dD986qwDqXTsx4IraLP4Dv/6W78tyO9WaoQRBse9pgriIBuRb7iOiBes/LVYHO 31CPPZW4jYJfNUBsCGb3UjI0rBcp+lYExOop8HIpbGL3MjnqNiMXhc2KJe+VCBhDZlp/ /vQtZIhuIjlWaF3nGDB9nusDY8U8sT2FJI9/ktoSoUjr5AZzsduPABYYJwqO3I2UHNWP zFgwWAGbE9fXbgmo73TBdbh2pdMz9zqEJEEMWFjMtXVD2j/ojEBI9gYiQdsWMTa8uSlK qVVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=aoE6n/CJQM3tHYs05oNUhtz/q8V/cSiv10R0OFmbK0M=; b=pVyu2s78Pfs7xWpQEoPl1Wrt8kBrAxUKOX5U9x5kbTDLQyx1+AISpsGtBjoSy3ToUS T/ZjPcKzsbTh+Bd6MrlEFSNTuvrdGtjH7R2A9cZedr5LYk/2ZMcyxlMBnpBJosq6Dajr Et5RK7sBpCbTzqob76EQSzhsQ8eFNsHk1rhsSe338QFpUi8ORIPNkQEwhEAxWTzoJeOs MYDe0mItlKZi3P0FW2Yur5s/63lr6IlFdsHhj5rLqVZHjv4BememcjiyYuEumpuGoxW8 VHH4w1dUD3sSyMtkhCNN9ijcLNjdXL0oGpgalYqkRDlOsaV2LOj5uBzcTD8IfI1xMxVG tQEg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gu13si2717175ejb.691.2020.11.06.23.47.14; Fri, 06 Nov 2020 23:47:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbgKGHpy (ORCPT + 99 others); Sat, 7 Nov 2020 02:45:54 -0500 Received: from m176115.mail.qiye.163.com ([59.111.176.115]:24315 "EHLO m176115.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725985AbgKGHpy (ORCPT ); Sat, 7 Nov 2020 02:45:54 -0500 Received: from vivo-HP-ProDesk-680-G4-PCI-MT.vivo.xyz (unknown [58.251.74.231]) by m176115.mail.qiye.163.com (Hmail) with ESMTPA id B1DC16662F7; Sat, 7 Nov 2020 15:45:49 +0800 (CST) From: Wang Qing To: Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wang Qing Subject: [PATCH v3 bpf] trace: bpf: Fix passing zero to PTR_ERR() Date: Sat, 7 Nov 2020 15:45:44 +0800 Message-Id: <1604735144-686-1-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZGR8eGBkZT05IGEgaVkpNS09MSE5KTktJQkpVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS0hKQ1VLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Nzo6Vjo6HD8YHRwTNTkSCyJK TQowCUJVSlVKTUtPTEhOSk5LTUJIVTMWGhIXVQwaFRwKEhUcOw0SDRRVGBQWRVlXWRILWUFZTkNV SU5KVUxPVUlISllXWQgBWUFJS05PNwY+ X-HM-Tid: 0a75a1ab28649373kuwsb1dc16662f7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a bug when passing zero to PTR_ERR() and return. Fix smatch err. Signed-off-by: Wang Qing --- kernel/trace/bpf_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 4517c8b..5113fd4 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -1198,7 +1198,7 @@ static int bpf_btf_printf_prepare(struct btf_ptr *ptr, u32 btf_ptr_size, *btf = bpf_get_btf_vmlinux(); if (IS_ERR_OR_NULL(*btf)) - return PTR_ERR(*btf); + return IS_ERR(*btf) ? PTR_ERR(*btf) : -EINVAL; if (ptr->type_id > 0) *btf_id = ptr->type_id; -- 2.7.4