mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: zhengjun.xing@intel.com
To: rostedt@goodmis.org, mingo@redhat.com
Cc: linux-kernel@vger.kernel.org, zhengjun.xing@intel.com
Subject: [PATCH] tracing: Add *iter check for NULL
Date: Wed,  1 Jun 2016 16:31:10 +0800	[thread overview]
Message-ID: <1464769870-18344-1-git-send-email-zhengjun.xing@intel.com> (raw)

From: xingzhen <zhengjun.xing@intel.com>

3debb0a9ddb adding a "__used" to the variable in the
__trace_printk_fmt section. Sometimes it will cause
*iter to be NULL, then strcmp in lookup_format and
strcpy in hold_module_trace_bprintk_format will panic.

Signed-off-by: xingzhen <zhengjun.xing@intel.com>
---
 kernel/trace/trace_printk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index f96f038..82ecfb5 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -55,6 +55,8 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
 
 	mutex_lock(&btrace_mutex);
 	for (iter = start; iter < end; iter++) {
+		if (!*iter)
+			goto err;
 		struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter);
 		if (tb_fmt) {
 			*iter = tb_fmt->fmt;
@@ -75,6 +77,7 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
 		*iter = fmt;
 
 	}
+err:
 	mutex_unlock(&btrace_mutex);
 }
 
-- 
1.9.1

             reply	other threads:[~2016-06-01  8:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01  8:31 zhengjun.xing [this message]
2016-06-02 15:41 ` Namhyung Kim
2016-06-17 16:38 ` Steven Rostedt
2016-06-17 18:24   ` Steven Rostedt
2016-06-20  0:12     ` Namhyung Kim

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=1464769870-18344-1-git-send-email-zhengjun.xing@intel.com \
    --to=zhengjun.xing@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /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

Powered by JetHome