提交 11f2a61a 编写于 作者: B Bob Moore 提交者: Andi Kleen

ACPICA: Fix possible negative array index in acpi_ut_validate_exception

Added NULL fields to the exception string arrays to eliminate
the -1 subtraction on the SubStatus field.
Signed-off-by: NBob Moore <robert.moore@intel.com>
Signed-off-by: NLin Ming <ming.m.lin@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
上级 6719561f
...@@ -64,7 +64,7 @@ ACPI_MODULE_NAME("utmisc") ...@@ -64,7 +64,7 @@ ACPI_MODULE_NAME("utmisc")
******************************************************************************/ ******************************************************************************/
const char *acpi_ut_validate_exception(acpi_status status) const char *acpi_ut_validate_exception(acpi_status status)
{ {
acpi_status sub_status; u32 sub_status;
const char *exception = NULL; const char *exception = NULL;
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
...@@ -85,32 +85,28 @@ const char *acpi_ut_validate_exception(acpi_status status) ...@@ -85,32 +85,28 @@ const char *acpi_ut_validate_exception(acpi_status status)
case AE_CODE_PROGRAMMER: case AE_CODE_PROGRAMMER:
if (sub_status <= AE_CODE_PGM_MAX) { if (sub_status <= AE_CODE_PGM_MAX) {
exception = exception = acpi_gbl_exception_names_pgm[sub_status];
acpi_gbl_exception_names_pgm[sub_status - 1];
} }
break; break;
case AE_CODE_ACPI_TABLES: case AE_CODE_ACPI_TABLES:
if (sub_status <= AE_CODE_TBL_MAX) { if (sub_status <= AE_CODE_TBL_MAX) {
exception = exception = acpi_gbl_exception_names_tbl[sub_status];
acpi_gbl_exception_names_tbl[sub_status - 1];
} }
break; break;
case AE_CODE_AML: case AE_CODE_AML:
if (sub_status <= AE_CODE_AML_MAX) { if (sub_status <= AE_CODE_AML_MAX) {
exception = exception = acpi_gbl_exception_names_aml[sub_status];
acpi_gbl_exception_names_aml[sub_status - 1];
} }
break; break;
case AE_CODE_CONTROL: case AE_CODE_CONTROL:
if (sub_status <= AE_CODE_CTRL_MAX) { if (sub_status <= AE_CODE_CTRL_MAX) {
exception = exception = acpi_gbl_exception_names_ctrl[sub_status];
acpi_gbl_exception_names_ctrl[sub_status - 1];
} }
break; break;
......
...@@ -226,6 +226,7 @@ char const *acpi_gbl_exception_names_env[] = { ...@@ -226,6 +226,7 @@ char const *acpi_gbl_exception_names_env[] = {
}; };
char const *acpi_gbl_exception_names_pgm[] = { char const *acpi_gbl_exception_names_pgm[] = {
NULL,
"AE_BAD_PARAMETER", "AE_BAD_PARAMETER",
"AE_BAD_CHARACTER", "AE_BAD_CHARACTER",
"AE_BAD_PATHNAME", "AE_BAD_PATHNAME",
...@@ -239,6 +240,7 @@ char const *acpi_gbl_exception_names_pgm[] = { ...@@ -239,6 +240,7 @@ char const *acpi_gbl_exception_names_pgm[] = {
}; };
char const *acpi_gbl_exception_names_tbl[] = { char const *acpi_gbl_exception_names_tbl[] = {
NULL,
"AE_BAD_SIGNATURE", "AE_BAD_SIGNATURE",
"AE_BAD_HEADER", "AE_BAD_HEADER",
"AE_BAD_CHECKSUM", "AE_BAD_CHECKSUM",
...@@ -248,6 +250,7 @@ char const *acpi_gbl_exception_names_tbl[] = { ...@@ -248,6 +250,7 @@ char const *acpi_gbl_exception_names_tbl[] = {
}; };
char const *acpi_gbl_exception_names_aml[] = { char const *acpi_gbl_exception_names_aml[] = {
NULL,
"AE_AML_ERROR", "AE_AML_ERROR",
"AE_AML_PARSE", "AE_AML_PARSE",
"AE_AML_BAD_OPCODE", "AE_AML_BAD_OPCODE",
...@@ -285,6 +288,7 @@ char const *acpi_gbl_exception_names_aml[] = { ...@@ -285,6 +288,7 @@ char const *acpi_gbl_exception_names_aml[] = {
}; };
char const *acpi_gbl_exception_names_ctrl[] = { char const *acpi_gbl_exception_names_ctrl[] = {
NULL,
"AE_CTRL_RETURN_VALUE", "AE_CTRL_RETURN_VALUE",
"AE_CTRL_PENDING", "AE_CTRL_PENDING",
"AE_CTRL_TERMINATE", "AE_CTRL_TERMINATE",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册