Messages in this thread |  | | Date | Mon, 13 Apr 2015 10:41:41 -0300 | From | Arnaldo Carvalho de Melo <> | Subject | Re: [PATCH 9/9] tools lib traceevent: Honor operator priority |
| |
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
|  |