On Fri, 17 Apr 2015 09:29:02 -0400
Steven Rostedt <rost...@goodmis.org> wrote:

> On Fri, 17 Apr 2015 10:44:42 +0300
> Andrey Ryabinin <a.ryabi...@samsung.com> wrote:
> 
>  
> > And kasan is not needed to debug this further.
> > Just stick WARN_ON(ptr > call->print_fmt + strlen(call->print_fmt)) into 
> > the 'for' loop in update_event_printk().
> 
> Thanks, although I think I found the bug with just inspection. I put in
> WARN_ON(*ptr) at various locations to see if it triggers.

Yep, that's the issue.

Can you guys test this patch please:

-- Steve

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 39bcfc3f071d..97d454a4dbfb 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1753,6 +1753,8 @@ static void update_event_printk(struct ftrace_event_call 
*call,
                                ptr++;
                                /* Check for alpha chars like ULL */
                        } while (isalnum(*ptr));
+                       if (!*ptr)
+                               break;
                        /*
                         * A number must have some kind of delimiter after
                         * it, and we can ignore that too.
@@ -1779,12 +1781,16 @@ static void update_event_printk(struct 
ftrace_event_call *call,
                        do {
                                ptr++;
                        } while (isalnum(*ptr) || *ptr == '_');
+                       if (!*ptr)
+                               break;
                        /*
                         * If what comes after this variable is a '.' or
                         * '->' then we can continue to ignore that string.
                         */
                        if (*ptr == '.' || (ptr[0] == '-' && ptr[1] == '>')) {
                                ptr += *ptr == '.' ? 1 : 2;
+                               if (!*ptr)
+                                       break;
                                goto skip_more;
                        }
                        /*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to