public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	stable@vger.kernel.org, Wei Yongjun <weiyongjun1@huawei.com>
Subject: [for-next][PATCH 8/8] tracing: Fix return value check in trace_benchmark_reg()
Date: Wed, 15 Feb 2017 09:04:58 -0500	[thread overview]
Message-ID: <20170215140505.072889500@goodmis.org> (raw)
In-Reply-To: 20170215140450.739053917@goodmis.org

[-- Attachment #1: 0008-tracing-Fix-return-value-check-in-trace_benchmark_re.patch --]
[-- Type: text/plain, Size: 1127 bytes --]

From: Wei Yongjun <weiyongjun1@huawei.com>

In case of error, the function kthread_run() returns ERR_PTR() and never
returns NULL. The NULL test in the return value check should be replaced
with IS_ERR().

Link: http://lkml.kernel.org/r/20170112135502.28556-1-weiyj.lk@gmail.com

Cc: stable@vger.kernel.org
Fixes: 81dc9f0e ("tracing: Add tracepoint benchmark tracepoint")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_benchmark.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_benchmark.c b/kernel/trace/trace_benchmark.c
index e3b488825ae3..e49fbe901cfc 100644
--- a/kernel/trace/trace_benchmark.c
+++ b/kernel/trace/trace_benchmark.c
@@ -175,9 +175,9 @@ int trace_benchmark_reg(void)
 
 	bm_event_thread = kthread_run(benchmark_event_kthread,
 				      NULL, "event_benchmark");
-	if (!bm_event_thread) {
+	if (IS_ERR(bm_event_thread)) {
 		pr_warning("trace benchmark failed to create kernel thread\n");
-		return -ENOMEM;
+		return PTR_ERR(bm_event_thread);
 	}
 
 	return 0;
-- 
2.10.2

      parent reply	other threads:[~2017-02-15 14:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15 14:04 [for-next][PATCH 0/8] tracing: More updates for 4.11 Steven Rostedt
2017-02-15 14:04 ` [for-next][PATCH 1/8] tracing: Have COMM event filter key be treated as a string Steven Rostedt
2017-02-15 14:04 ` [for-next][PATCH 2/8] tracing: Have traceprobe_probes_write() not access userspace unnecessarily Steven Rostedt
2017-02-15 14:04 ` [for-next][PATCH 3/8] timers: Make flags output in the timer_start tracepoint useful Steven Rostedt
2017-02-15 14:04 ` [for-next][PATCH 4/8] tracing/hwlat: Update old comment about migration Steven Rostedt
2017-02-15 14:04 ` [for-next][PATCH 5/8] tracing/probe: Show subsystem name in messages Steven Rostedt
2017-02-15 14:04 ` [for-next][PATCH 6/8] jump_label: Reduce the size of struct static_key Steven Rostedt
2017-02-15 14:04 ` [for-next][PATCH 7/8] tracing: Use modern function declaration Steven Rostedt
2017-02-15 14:04 ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170215140505.072889500@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=weiyongjun1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox