Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1810010pxb; Fri, 6 Nov 2020 22:37:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUqRwH4Beot5hR/8ScjWjoSC1G/WB+2Lnalm7Cm8tqsrJ28aOXYggOj79Gnctn+OFXusmm X-Received: by 2002:a17:906:a28f:: with SMTP id i15mr6024543ejz.468.1604731061826; Fri, 06 Nov 2020 22:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604731061; cv=none; d=google.com; s=arc-20160816; b=XLehtaeQ865xvKdSIObDjMaEF3w5WKYP169YGSb5x3h4pwKKQRSHJNMs/EzZisiJ8M ZwC/kciSVM/9/F8LZeJWGlUNG39vu5PDI9T0k3mLuKIFaC34NZOnGcxXn+jqJcFmfV9k Y7rlz822uPUjtLnMPKxR6kERuP9+tj7Yqjbkxe0oLNBW93bo+5rXbJDc5hFXWNCQ6T6Z Go7EfexizGCrAPmFw9V7UDalE7Kx/HRXpzMVuSkNd9p9kcEgyJhV03vphWAAu5Dlcue+ aV9fzLCdlDxGx6uOUqpYObT4W4O5Pf7fU3x2R0iunCSt1DYlmxF2p+RkxpTOWqx1Jppb mbMw== 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=TiT+1uSS9tiS5rxe5AIHrrTTekSYQ/GoTHoBdn7VckNyfZ3BHij+BBLZtgvqS2hFbj pncC8F9VTrzSWOFBXs/MO2HoWj1MZGAnP/rqMEwQ1WeDTBBfTDGmR8vNgYSL3h9yzOrV 8BU9E+N6eevgXg72bUm8H+YZUhoG9t5cst5a9jmH/LZctzzQ6mVJZ64B0dqGWgx0Qc0p DP78xtEyBiga9+b4MntEoEuFND2hpVh3kDh1IkGM5lMMMHguzGwOF64fITjoUSu+7M76 dCeGsga9z2/GZrJSDCx1n2SGqtVFxYJkDzM2QX7KgUMZxQfxqohK6/3G58rM6dU/JNLZ CXQQ== 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 n9si2848760ejo.640.2020.11.06.22.37.19; Fri, 06 Nov 2020 22:37:41 -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 S1727989AbgKGGfG (ORCPT + 99 others); Sat, 7 Nov 2020 01:35:06 -0500 Received: from m176115.mail.qiye.163.com ([59.111.176.115]:8635 "EHLO m176115.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727799AbgKGGfF (ORCPT ); Sat, 7 Nov 2020 01:35:05 -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 245C76664CF; Sat, 7 Nov 2020 14:35:01 +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: [V2] trace: Fix passing zero to PTR_ERR() Date: Sat, 7 Nov 2020 14:34:56 +0800 Message-Id: <1604730896-3335-1-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZS0wdSR8ZTElOQ0NPVkpNS09MSEtCS0pMSEtVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS0hKQ1VLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Pgw6PSo*Hj8ZPxwKGB1JCQEO FkMwCxxVSlVKTUtPTEhLQktJSk1KVTMWGhIXVQwaFRwKEhUcOw0SDRRVGBQWRVlXWRILWUFZTkNV SU5KVUxPVUlISllXWQgBWUFJS0lNNwY+ X-HM-Tid: 0a75a16a54719373kuws245c76664cf 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