hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/acpi/acpica/dswstate.c
....@@ -576,9 +576,14 @@
576576 ACPI_FUNCTION_TRACE(ds_init_aml_walk);
577577
578578 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
+ }
582587
583588 /* The next_op of the next_walk will be the beginning of the method */
584589