Re: [PATCH 9/9] tools lib traceevent: Honor operator priority

From: Arnaldo Carvalho de Melo
Date: Mon Apr 13 2015 - 09:41:50 EST


Em Mon, Apr 06, 2015 at 02:36:16PM +0900, Namhyung Kim escreveu:
> Currently it ignores operator priority and just sets processed args as a
> right operand. But it could result in priority inversion in case that
> the right operand is also a operator arg and its priority is lower.
>
> For example, following print format is from new kmem events.
>
> "page=%p", REC->pfn != -1UL ? (((struct page *)(0xffffea0000000000UL)) + (REC->pfn)) : ((void *)0)
>
> But this was treated as below:
>
> REC->pfn != ((null - 1UL) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)
>
> In this case, the right arg was '?' operator which has lower priority.
> But it just sets the whole arg so making the output confusing - page was
> always 0 or 1 since that's the result of logical operation.
>
> With this patch, it can handle it properly like following:
>
> ((REC->pfn != (null - 1UL)) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)

And this one already went upstream.

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/