Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5944760ybi; Wed, 12 Jun 2019 11:08:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAwCA5c7VLrOZdE5GERXIboXKWpuDxtJlYOJqaNWe0s5HPaSAnbAI4CsF0XuM7bgwugOUs X-Received: by 2002:a63:2a06:: with SMTP id q6mr26138544pgq.290.1560362916961; Wed, 12 Jun 2019 11:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560362916; cv=none; d=google.com; s=arc-20160816; b=bFwBMxuoqQIyJCSfJ7wTmD1mEDyKZQDkyajN2rzA1G2xbtrpt6Js/p6Ynv//6vkPaN 5Gdg4y5D7R99mHjBMUnrB2oRpqZVykSR/o3tXRGupZwr/nVFQ/vpX16jBSZ4hjDhUrhx qwE0RLQ1E9ME/6KQ3YvtyQAOrzlbmR5G+7sDbSag/kMHRDYSHAWOnq7JJ4jhaLqqiYk/ urfa0x5fq+LIs82ulo3ZUcqrSZFYQa4zwlRVSpIwuqOVIVZypKk6uoeAGBsIB7HSId/M nTmQCpXhCW0lJMo/grsSR+0ZrUBG3A7CkE2NJg+qBH2W0WnZJFSc306/WooDNooPuG39 DKLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=u1MyMIZ9ok0ySc46TdDKcyLo7QKg6zWv+KorvuliDxY=; b=HyRsiuFLF32QMYRvettgFZHfnlMZJENnggmL2xX9c2G7awBid5FR2wvbD8ddu+4c5f iN2iE8KGU1peydHbnnk32E1/0MRCbIzi+drdo1d/dG0FtoTDFWOf5NWWihTXoRewBYMB uwcTJgip7spvjW5nCDE5ognpseXxQCMwiJBgDDlizrSPi4CB+NguQhMyi7Y5P6mtlIRM RpPD7seNGqzykJ8TAF+If1FI/cak+eAev+Na3v13SjvDDdE2SQCKsi6lTXicGX7MxdnT yMg0zSL/h5PJbcOR+6PzLxqNn43oa2uSYJ66LozEUiTZ2d/aUfzXs9C2aqbC6QevWe9r i1eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=KvLfP+yU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10si426869pjp.74.2019.06.12.11.08.22; Wed, 12 Jun 2019 11:08:36 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=KvLfP+yU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502164AbfFLQf2 (ORCPT + 99 others); Wed, 12 Jun 2019 12:35:28 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:54424 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440265AbfFLQf0 (ORCPT ); Wed, 12 Jun 2019 12:35:26 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CGXiIb191120; Wed, 12 Jun 2019 16:34:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=u1MyMIZ9ok0ySc46TdDKcyLo7QKg6zWv+KorvuliDxY=; b=KvLfP+yUMoqZqoV2VxljaKgVLxiNEBLtU/C3ZoxCDPc+/pP1qfRwCT/KXtY9wxqLqM7r LZG/pVRlXA9L19MjGJ8P+iElUWG9Muccu2/2/miK+dXOspEOTUSzHYD9R/mYXyB+MV9i 0f+lMzZsVj3xhSqyfXuu5b/orMcoxNTf3Syh5nWT+His5r22cWpf/BaxZAgATR3WKsF5 379TWdgYQya4mE+dPNSLzCuml7cLOZlFZC7xDmbV72ETaIwp2lWO5YLoyEXz4HbrX2VD XMaBVxKBngGrKaoFyFigTdfHTd8a0cgI9RKHbT2uFynnGctnYFzjrrbwBlcT4rXo1M0l gQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 2t02hevv49-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 16:34:56 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CGXJjq113195; Wed, 12 Jun 2019 16:34:55 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2t024v2ura-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 16:34:55 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5CGYtvS026219; Wed, 12 Jun 2019 16:34:55 GMT Received: from ca-common-hq.us.oracle.com (/10.211.9.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 09:34:54 -0700 From: Divya Indi To: linux-kernel@vger.kernel.org, Steven Rostedt Cc: Divya Indi , Srinivas Eeda , Aruna Ramakrishna Subject: [PATCH 2/3] tracing: Adding additional NULL checks. Date: Wed, 12 Jun 2019 09:34:18 -0700 Message-Id: <1560357259-3497-3-git-send-email-divya.indi@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1560357259-3497-2-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> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9286 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120112 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9286 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120112 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit f45d1225adb0 ("tracing: Kernel access to Ftrace instances") exported certain functions providing access to Ftrace instances from other kernel components. 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. -- 1.8.3.1