Skip to content

Commit

Permalink
ring-buffer: Fix return value check in test_ringbuffer()
Browse files Browse the repository at this point in the history
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/1466184839-14927-1-git-send-email-weiyj_lk@163.com

Cc: stable@vger.kernel.org
Fixes: 6c43e55 ("ring-buffer: Add ring buffer startup selftest")
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
Wei Yongjun authored and Steven Rostedt (VMware) committed Apr 5, 2017
1 parent a71c9a1 commit 62277de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -4826,9 +4826,9 @@ static __init int test_ringbuffer(void)
rb_data[cpu].cnt = cpu;
rb_threads[cpu] = kthread_create(rb_test, &rb_data[cpu],
"rbtester/%d", cpu);
if (WARN_ON(!rb_threads[cpu])) {
if (WARN_ON(IS_ERR(rb_threads[cpu]))) {
pr_cont("FAILED\n");
ret = -1;
ret = PTR_ERR(rb_threads[cpu]);
goto out_free;
}

Expand All @@ -4838,9 +4838,9 @@ static __init int test_ringbuffer(void)

/* Now create the rb hammer! */
rb_hammer = kthread_run(rb_hammer_test, NULL, "rbhammer");
if (WARN_ON(!rb_hammer)) {
if (WARN_ON(IS_ERR(rb_hammer))) {
pr_cont("FAILED\n");
ret = -1;
ret = PTR_ERR(rb_hammer);
goto out_free;
}

Expand Down

0 comments on commit 62277de

Please sign in to comment.