During expression parsing, a new expression field is created which should inherit the properties of the operands, such as size and is_signed. is_signed propagation was missing, causing spurious errors with signed operands. Add it in parse_expr() and parse_unary() to fix the problem. Link: https://lkml.kernel.org/r/f4dac08742fd7a0920bf80a73c6c44042f5eaa40.1643319703.git.zanussi@kernel.org
Unified · Split
| @@ -2503,6 +2503,8 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, · 2502 unmodified lines | |||
| 2503 | (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS); | 2503 | (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS); |
| 2504 | expr->fn = hist_field_unary_minus; | 2504 | expr->fn = hist_field_unary_minus; |
| 2505 | expr->operands[0] = operand1; | 2505 | expr->operands[0] = operand1; |
| 2506 | expr->size = operand1->size; | ||
| 2507 | expr->is_signed = operand1->is_signed; | ||
| 2506 | expr->operator = FIELD_OP_UNARY_MINUS; | 2508 | expr->operator = FIELD_OP_UNARY_MINUS; |
| 2507 | expr->name = expr_str(expr, 0); | 2509 | expr->name = expr_str(expr, 0); |
| 2508 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); | 2510 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); |
| @@ -2719,6 +2721,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, · 210 unmodified lines | |||
| 2719 | 2721 | ||
| 2720 | /* The operand sizes should be the same, so just pick one */ | 2722 | /* The operand sizes should be the same, so just pick one */ |
| 2721 | expr->size = operand1->size; | 2723 | expr->size = operand1->size; |
| 2724 | expr->is_signed = operand1->is_signed; | ||
| 2722 | 2725 | ||
| 2723 | expr->operator = field_op; | 2726 | expr->operator = field_op; |
| 2724 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); | 2727 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); |