Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp88280ybm; Thu, 28 May 2020 16:52:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAaIT5dak+Ph00vZwrr4qbBawGSfmVrVUsNcp2Bsi2JiP1+ld+gZvirfS/pK+ucDMU3RxO X-Received: by 2002:a50:d1d3:: with SMTP id i19mr5580217edg.35.1590709964605; Thu, 28 May 2020 16:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590709964; cv=none; d=google.com; s=arc-20160816; b=lzyLHs+LWgKNrIXHPvdogjcxR+k4ZoJwDHyTvwXFqEk1Ff9DFEugEOMy0klNU1uiu2 tu+jnn80yiZm4N4pkVDip2PXm4DffuICQI9HLIomsg8bVSAzTJftxreVbWddEQqgqSIk WLCUG0R03b3SCt6DpAS+H/cC4nDCzUQqqiMiuOpe9HAnqWA0W8LppJFQHi4AxWRtGWW0 XGwxvw20kHjNWqGORnZ8aPXoWWsGDSE8At3iQ+/KZzFo+imEBSdm9bBIhd4+FoKN89hQ 3+0mWs2WTsLskadT4P2fPMMBPFeF4z39ny1pG5P/yL4kaQKyrC+lwNBFlW15jS2FCh9w vucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=TJ5k20qlAAgpDeT4ZvVKEd2MYTDLcZqDAWyB6sphJyw=; b=ZUhFjbGhwRncJcbTtS00kudC8ee7/2d6Cany683j6VwDiMP8HFisDzBna7IUYmmaiB J1Bkrb/Q8a24l7dX1esA1+0+eAevnPoSszLnlfjfczn29N/lHSpzKfEGAnAyZMGN1OYT 2F/6JywEuPqZuCPgitkXI60x7SZdRapDEpI8ptqIcK3FebRn3dWGAwGcH2dhB7YSHigW zJIsxb6vaYGD8FH1dyq0FPrr/Z03B2yxs8DnKi3f8lTaVW/pjHleev4jVg+Wist5s8tS 59VCr2/+S+85mvwen8SiU8FpRSPiX1sP40sIYiVkGnt2E66XrGKs3JgJFuG3zwMWOwEm mh5Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x25si5119969ejs.242.2020.05.28.16.52.21; Thu, 28 May 2020 16:52:44 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437803AbgE1Xt6 (ORCPT + 99 others); Thu, 28 May 2020 19:49:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:60262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437776AbgE1Xt2 (ORCPT ); Thu, 28 May 2020 19:49:28 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C997C2075F; Thu, 28 May 2020 23:49:27 +0000 (UTC) Date: Thu, 28 May 2020 19:49:25 -0400 From: Steven Rostedt To: Kaitao Cheng Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, songmuchun@bytedance.com Subject: Re: [PATCH] trace/ftrace: fix maybe-uninitialized compiler warning Message-ID: <20200528194925.6eec098c@oasis.local.home> In-Reply-To: <20200523155304.29554-1-pilgrimtao@gmail.com> References: <20200523155304.29554-1-pilgrimtao@gmail.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kaitao, Sorry for the late response, I've been a bit swamped. On Sat, 23 May 2020 23:53:04 +0800 Kaitao Cheng wrote: > During build compiler reports some 'false positive' warnings about > variables {'seq_ops', 'filtered_pids', 'other_pids'} may be used > uninitialized. This patch silences these warnings. > Also delete some useless spaces > > Signed-off-by: Kaitao Cheng > --- > kernel/trace/ftrace.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 7d0ebd104706..01a61bdc4e63 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -2260,7 +2260,7 @@ ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, > > if (hash_contains_ip(ip, op->func_hash)) > return op; > - } > + } > > return NULL; > } > @@ -3599,7 +3599,7 @@ static int t_show(struct seq_file *m, void *v) > if (direct) > seq_printf(m, "\n\tdirect-->%pS", (void *)direct); > } > - } > + } > > seq_putc(m, '\n'); > > @@ -7151,6 +7151,9 @@ static int pid_open(struct inode *inode, struct file *file, int type) > case TRACE_NO_PIDS: > seq_ops = &ftrace_no_pid_sops; > break; > + default: > + trace_array_put(tr); > + return -EINVAL; > } > > ret = seq_open(file, seq_ops); > @@ -7229,6 +7232,9 @@ pid_write(struct file *filp, const char __user *ubuf, > other_pids = rcu_dereference_protected(tr->function_pids, > lockdep_is_held(&ftrace_lock)); > break; > + default: > + ret = -EINVAL; As these are anomalies, and should never happen, we should probably add a WARN_ON_ONCE(1); here as well. Care to send a v2? Thanks! -- Steve > + goto out; > } > > ret = trace_pid_write(filtered_pids, &pid_list, ubuf, cnt);