Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3100955ybi; Mon, 17 Jun 2019 16:37:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPBFAF5JuqbQaXSTXP90DqLUXQCCYdPRzhofdQ2/o6d5gEVVcFf5Uw6JzmgOKopNN6wBr/ X-Received: by 2002:a62:b40f:: with SMTP id h15mr108670890pfn.57.1560814649036; Mon, 17 Jun 2019 16:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560814649; cv=none; d=google.com; s=arc-20160816; b=hd4LpyM97IYSvf3j++Fx9MExWhPfSUYjSkMOLzFzoaoRKerVq3rDuUgphVijhnq/Vt gm1d3uOFw03gMbRP+4gHp9sgQaW+iU5BB78Rf1Wno6ANclytT9t+snLDqI0evPAjZ2K/ pwxfNpPn0bcYXNpGMC/jpZ4zloam65EHMooBemiKYUv/A/h+KpoBxvU4Hgg4CTq0MS6Y Re0YI50A02V09HYgA6TIx2/ggY+1vl+xc+b8kmtWZs0ZTYr+MN906sGGydGXrbZIjMzt R6ffjcjbFQj2rMigAXunRtE10pOY+yNheM9bo/j9d3SuLhh2oqJPmssbssTP+cWbCRuf Kfiw== 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=TRXlNuDnWn3FkL1oqZ0O+fnQavvU8Z5H5Vn7f1xyeCM=; b=tKBz3EKBdoHZcMHK/4O/Zs2Qt7JOn6HI+4uNrujrk0XFKKqAWRr0IMtopey9mbd3Uf WkbpaktQqiyMGK0Jy4OyBAtDK6f0yqz1R1U17up8VQ+YpyO5wBL29W5wiFP1JjVFrMZc vaqiJTZZok+UapG6SlJECllInrSx4fOAxmzPuCHPwrX7FOnRUxnMl9QH6l0eCu4bGeFz OotdS6dAO2pfzuxP2vXggoxUMhQ6p8nsFiA3quRXu5jTixRR2xvqZYGpUObClk+y5Mok TG83Sv87glvASPD1L/F4fRr+VHcwzXPJx10engRlk+6bAYwa6ZekCtPVwVBInj6mLiWG 2B4g== 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 91si11386880plc.54.2019.06.17.16.37.13; Mon, 17 Jun 2019 16:37:29 -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; 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 S1728571AbfFQXhC (ORCPT + 99 others); Mon, 17 Jun 2019 19:37:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:39184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726808AbfFQXhC (ORCPT ); Mon, 17 Jun 2019 19:37:02 -0400 Received: from gandalf.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 D7454208C0; Mon, 17 Jun 2019 23:37:00 +0000 (UTC) Date: Mon, 17 Jun 2019 19:36:59 -0400 From: Steven Rostedt To: Divya Indi Cc: linux-kernel@vger.kernel.org, Srinivas Eeda , Aruna Ramakrishna Subject: Re: [PATCH 2/3] tracing: Adding additional NULL checks. Message-ID: <20190617193659.59b28700@gandalf.local.home> In-Reply-To: <1560357259-3497-3-git-send-email-divya.indi@oracle.com> References: <1560357259-3497-1-git-send-email-divya.indi@oracle.com> <1560357259-3497-2-git-send-email-divya.indi@oracle.com> <1560357259-3497-3-git-send-email-divya.indi@oracle.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 On Wed, 12 Jun 2019 09:34:18 -0700 Divya Indi wrote: > commit f45d1225adb0 ("tracing: Kernel access to Ftrace instances") > exported certain functions providing access to Ftrace instances from > other kernel components. I'm fine with the patch, the above statement is hard to understand. -- Steve > Adding some additional NULL checks to ensure safe usage by the users. > > Signed-off-by: Divya Indi > --- > kernel/trace/trace.c | 3 +++ > kernel/trace/trace_events.c | 2 ++ > 2 files changed, 5 insertions(+) > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index 1c80521..a60dc13 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -3205,6 +3205,9 @@ int trace_array_printk(struct trace_array *tr, > if (!(global_trace.trace_flags & TRACE_ITER_PRINTK)) > return 0; > > + if (!tr) > + return -EINVAL; > + > va_start(ap, fmt); > ret = trace_array_vprintk(tr, ip, fmt, ap); > va_end(ap); > diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c > index b6b4618..445b059 100644 > --- a/kernel/trace/trace_events.c > +++ b/kernel/trace/trace_events.c > @@ -800,6 +800,8 @@ int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set) > char *event = NULL, *sub = NULL, *match; > int ret; > > + if (!tr) > + return -ENODEV; > /* > * The buf format can be : > * *: means any event by that name.