Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3327926imu; Sun, 11 Nov 2018 12:28:26 -0800 (PST) X-Google-Smtp-Source: AJdET5cIPm/Z/xHZLwfbr3QHndJapWCnPX4U4utOCQg7TosMnah1t/wwxhXWV/exVtlWjVJYgrIG X-Received: by 2002:a62:4587:: with SMTP id n7mr396909pfi.118.1541968106502; Sun, 11 Nov 2018 12:28:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968106; cv=none; d=google.com; s=arc-20160816; b=nEh7/vS8GX9Jluo1cGkeYmC8FqciDXE8piEBsbo2Z0myFFDzcAi0hMs3wvR5mdipQ4 9vXgNaTywv5rTcxZbXd3uEJaOVT2ZK2B9iN1vZAt7yoj/moI/xMr8LH4DWr5g8wvlHA2 KLcpg/UtbUE6RKLU0oY7kbpRbV4uyB7JazMRgroSlOQDEDCS1q7jNjOM0c/e3v5e47G7 lMZ8yggu+0iT6H8gQrFwuw2Y1zKBtVnQj9kgERwVEe6pB7Kn7FgRAPxpsOJjwzqBAgEf 3dSweoxaZX0q01mufcKOs+o5AUnm+nmBImgwWKUr9n7ZlFjqoDFbUe7kUyS9Ly8dqu7T APdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=sad05BeUTBn/qi+1dzhODCVno3MDQCDI1cgz1kGtiJw=; b=jb/cnFs+grjvyZ4us4bqoNQ8dfuLriHZZkJyYIIn6VUGHgG1QnClcyfWvygP/xN1R0 39g7PXPvvMdxIBZYuYdl8fqWqoy3UZx2MVIdbgXhC9mbFGbYRELdplM+Bs7x2KgDSf30 d3frIV23x+LqTKlmZmDmeNDthn7zunUg7v3/jhqU4WHUN1mo8LFKSnsoyvEIzVl1YWMz esgia3kf1CGKvWCXK7l3bMQ/HHGGqBHK7KlqgL0eUgPOKFJFhdrGpx9ZYbhFohEM0lk9 0vqekjItaLS1H4iphzYz3jELVGjONYxgupnlstfqX/AX83dpoaMCWNgIrO8A5+AjlOAo DeIA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si14897168pgr.411.2018.11.11.12.28.11; Sun, 11 Nov 2018 12:28:26 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731484AbeKLGQK (ORCPT + 99 others); Mon, 12 Nov 2018 01:16:10 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50870 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730392AbeKLFs1 (ORCPT ); Mon, 12 Nov 2018 00:48:27 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsl-0000oP-HE; Sun, 11 Nov 2018 19:58:55 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsY-0001mp-Fp; Sun, 11 Nov 2018 19:58:42 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Steven Rostedt (VMware)" , "kbuild test robot" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 297/366] tracing: Quiet gcc warning about maybe unused link variable In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: "Steven Rostedt (VMware)" commit 2519c1bbe38d7acacc9aacba303ca6f97482ed53 upstream. Commit 57ea2a34adf4 ("tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure") added an if statement that depends on another if statement that gcc doesn't see will initialize the "link" variable and gives the warning: "warning: 'link' may be used uninitialized in this function" It is really a false positive, but to quiet the warning, and also to make sure that it never actually is used uninitialized, initialize the "link" variable to NULL and add an if (!WARN_ON_ONCE(!link)) where the compiler thinks it could be used uninitialized. Fixes: 57ea2a34adf4 ("tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure") Reported-by: kbuild test robot Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Ben Hutchings --- kernel/trace/trace_kprobe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -361,7 +361,7 @@ static struct trace_kprobe *find_trace_k static int enable_trace_kprobe(struct trace_kprobe *tk, struct ftrace_event_file *file) { - struct event_file_link *link; + struct event_file_link *link = NULL; int ret = 0; if (file) { @@ -387,7 +387,9 @@ enable_trace_kprobe(struct trace_kprobe if (ret) { if (file) { - list_del_rcu(&link->list); + /* Notice the if is true on not WARN() */ + if (!WARN_ON_ONCE(!link)) + list_del_rcu(&link->list); kfree(link); tk->tp.flags &= ~TP_FLAG_TRACE; } else {