Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPICA: iASL: Return exceptions for string-to-integer conversions

This allows iASL to generate errors by passing exceptions that may be
encountered during string-to-integer conversions. The exceptions
point out invalid hex, decimal, and octal integers.

ACPICA commit e98b8c0a3d96fdabb167c0ef18a809b32ade3228

Link: https://github.com/acpica/acpica/commit/e98b8c0a
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Bob Moore and committed by
Rafael J. Wysocki
ef3efb43 18aaa02c

+26 -11
+24 -9
drivers/acpi/acpica/utstrsuppt.c
··· 45 45 /* Convert each ASCII byte in the input string */ 46 46 47 47 while (*string) { 48 - 49 - /* Character must be ASCII 0-7, otherwise terminate with no error */ 50 - 48 + /* 49 + * Character must be ASCII 0-7, otherwise: 50 + * 1) Runtime: terminate with no error, per the ACPI spec 51 + * 2) Compiler: return an error 52 + */ 51 53 if (!(ACPI_IS_OCTAL_DIGIT(*string))) { 54 + #ifdef ACPI_ASL_COMPILER 55 + status = AE_BAD_OCTAL_CONSTANT; 56 + #endif 52 57 break; 53 58 } 54 59 ··· 99 94 /* Convert each ASCII byte in the input string */ 100 95 101 96 while (*string) { 102 - 103 - /* Character must be ASCII 0-9, otherwise terminate with no error */ 104 - 97 + /* 98 + * Character must be ASCII 0-9, otherwise: 99 + * 1) Runtime: terminate with no error, per the ACPI spec 100 + * 2) Compiler: return an error 101 + */ 105 102 if (!isdigit(*string)) { 103 + #ifdef ACPI_ASL_COMPILER 104 + status = AE_BAD_DECIMAL_CONSTANT; 105 + #endif 106 106 break; 107 107 } 108 108 ··· 153 143 /* Convert each ASCII byte in the input string */ 154 144 155 145 while (*string) { 156 - 157 - /* Must be ASCII A-F, a-f, or 0-9, otherwise terminate with no error */ 158 - 146 + /* 147 + * Character must be ASCII A-F, a-f, or 0-9, otherwise: 148 + * 1) Runtime: terminate with no error, per the ACPI spec 149 + * 2) Compiler: return an error 150 + */ 159 151 if (!isxdigit(*string)) { 152 + #ifdef ACPI_ASL_COMPILER 153 + status = AE_BAD_HEX_CONSTANT; 154 + #endif 160 155 break; 161 156 } 162 157
+2 -2
include/acpi/acexcep.h
··· 40 40 struct acpi_exception_info { 41 41 char *name; 42 42 43 - #ifdef ACPI_HELP_APP 43 + #if defined (ACPI_HELP_APP) || defined (ACPI_ASL_COMPILER) 44 44 char *description; 45 45 #endif 46 46 }; 47 47 48 - #ifdef ACPI_HELP_APP 48 + #if defined (ACPI_HELP_APP) || defined (ACPI_ASL_COMPILER) 49 49 #define EXCEP_TXT(name,description) {name, description} 50 50 #else 51 51 #define EXCEP_TXT(name,description) {name}