Re: [PATCH] pfn_t: force '~' to be parsed as an unary operator

From: sebhtml
Date: Wed Oct 24 2018 - 20:08:07 EST

On 2018-10-24 6:43 p.m., Andrew Morton wrote:

I grabbed it, and added cc:stable.

But aren't we fixing this in the wrong place? That's a valid
expression and if this isn't addressed in perf then we may hit a
similar issue elsewhere...


Based on:
git:// 01aa9d518eae8a4d75cd3049defc6ed0b6d0a658

In perf, the warning
[fs_dax:dax_pmd_insert_mapping] unknown op '~'
comes from tools/lib/traceevent/event-parse.c at line 2045:
do_warning_event(event, "unknown op '%s'", token);

This is in this function:

static enum tep_event_type
process_op(struct tep_event_format *event, struct tep_print_arg *arg, char **tok);

The code path to reach the good '~' case needs:
if (arg->type == TEP_PRINT_OP && !arg->op.left) {

I assume that here arg->op.left is not NULL because of (u64) on the left.

~(((u64) ~(~(((1UL) << 12)-1)))

However, I fail to see where '~' is parsed as a binary operator though.

Any pointer would be welcome.