.. | .. |
---|
576 | 576 | ACPI_FUNCTION_TRACE(ds_init_aml_walk); |
---|
577 | 577 | |
---|
578 | 578 | walk_state->parser_state.aml = |
---|
579 | | - walk_state->parser_state.aml_start = aml_start; |
---|
580 | | - walk_state->parser_state.aml_end = |
---|
581 | | - walk_state->parser_state.pkg_end = aml_start + aml_length; |
---|
| 579 | + walk_state->parser_state.aml_start = |
---|
| 580 | + walk_state->parser_state.aml_end = |
---|
| 581 | + walk_state->parser_state.pkg_end = aml_start; |
---|
| 582 | + /* Avoid undefined behavior: applying zero offset to null pointer */ |
---|
| 583 | + if (aml_length != 0) { |
---|
| 584 | + walk_state->parser_state.aml_end += aml_length; |
---|
| 585 | + walk_state->parser_state.pkg_end += aml_length; |
---|
| 586 | + } |
---|
582 | 587 | |
---|
583 | 588 | /* The next_op of the next_walk will be the beginning of the method */ |
---|
584 | 589 | |
---|