[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/ACPI: Use const char * for string literals
commit ceab2c1acd1098a3506b5128a001f3b4994b1176 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri Jul 14 13:27:50 2023 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Mon Jul 17 11:35:41 2023 +0100 xen/ACPI: Use const char * for string literals For pre-ANSI-C compatibility reasons, string literals have a mutable type, but it is undefined behaviour to mutate them. Swap char *'s to const char *'s for variables which hold string literals. This fixes several violations of MISRA Rule 7.4: A string literal shall not be assigned to an object unless the object's type is "pointer to const-qualified char". No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Julien Grall <jgrall@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/drivers/acpi/tables.c | 6 +++--- xen/drivers/acpi/tables/tbfadt.c | 2 +- xen/drivers/acpi/tables/tbutils.c | 2 +- xen/drivers/acpi/utilities/utmisc.c | 6 +++--- xen/include/acpi/actables.h | 2 +- xen/include/acpi/acutils.h | 12 ++++++------ xen/include/xen/acpi.h | 6 +++--- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/xen/drivers/acpi/tables.c b/xen/drivers/acpi/tables.c index 96ff96b84c..20aed8929b 100644 --- a/xen/drivers/acpi/tables.c +++ b/xen/drivers/acpi/tables.c @@ -300,7 +300,7 @@ acpi_table_get_entry_madt(enum acpi_madt_type entry_id, } int __init -acpi_parse_entries(char *id, unsigned long table_size, +acpi_parse_entries(const char *id, unsigned long table_size, acpi_table_entry_handler handler, struct acpi_table_header *table_header, int entry_id, unsigned int max_entries) @@ -359,7 +359,7 @@ acpi_parse_entries(char *id, unsigned long table_size, } int __init -acpi_table_parse_entries(char *id, +acpi_table_parse_entries(const char *id, unsigned long table_size, int entry_id, acpi_table_entry_handler handler, @@ -405,7 +405,7 @@ acpi_table_parse_madt(enum acpi_madt_type id, * Scan the ACPI System Descriptor Table (STD) for a table matching @id, * run @handler on it. */ -int __init acpi_table_parse(char *id, acpi_table_handler handler) +int __init acpi_table_parse(const char *id, acpi_table_handler handler) { struct acpi_table_header *table = NULL; diff --git a/xen/drivers/acpi/tables/tbfadt.c b/xen/drivers/acpi/tables/tbfadt.c index d8fcc50dec..a03836e0dc 100644 --- a/xen/drivers/acpi/tables/tbfadt.c +++ b/xen/drivers/acpi/tables/tbfadt.c @@ -60,7 +60,7 @@ static void acpi_tb_validate_fadt(void); /* Table for conversion of FADT to common internal format and FADT validation */ typedef struct acpi_fadt_info { - char *name; + const char *name; u16 target; u16 source; u16 length; diff --git a/xen/drivers/acpi/tables/tbutils.c b/xen/drivers/acpi/tables/tbutils.c index 11412c47de..458989abea 100644 --- a/xen/drivers/acpi/tables/tbutils.c +++ b/xen/drivers/acpi/tables/tbutils.c @@ -243,7 +243,7 @@ u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length) void __init acpi_tb_install_table(acpi_physical_address address, - u8 flags, char *signature, acpi_native_uint table_index) + u8 flags, const char *signature, acpi_native_uint table_index) { struct acpi_table_header *table; diff --git a/xen/drivers/acpi/utilities/utmisc.c b/xen/drivers/acpi/utilities/utmisc.c index 4e1497ad0f..ee22c83e38 100644 --- a/xen/drivers/acpi/utilities/utmisc.c +++ b/xen/drivers/acpi/utilities/utmisc.c @@ -134,7 +134,7 @@ const char *__init acpi_ut_validate_exception(acpi_status status) ******************************************************************************/ void ACPI_INTERNAL_VAR_XFACE __init -acpi_ut_error(const char *module_name, u32 line_number, char *format, ...) +acpi_ut_error(const char *module_name, u32 line_number, const char *format, ...) { va_list args; @@ -147,7 +147,7 @@ acpi_ut_error(const char *module_name, u32 line_number, char *format, ...) } void ACPI_INTERNAL_VAR_XFACE __init -acpi_ut_warning(const char *module_name, u32 line_number, char *format, ...) +acpi_ut_warning(const char *module_name, u32 line_number, const char *format, ...) { va_list args; @@ -161,7 +161,7 @@ acpi_ut_warning(const char *module_name, u32 line_number, char *format, ...) } void ACPI_INTERNAL_VAR_XFACE __init -acpi_ut_info(const char *module_name, u32 line_number, char *format, ...) +acpi_ut_info(const char *module_name, u32 line_number, const char *format, ...) { va_list args; diff --git a/xen/include/acpi/actables.h b/xen/include/acpi/actables.h index d4cad35f41..527e1c9f9b 100644 --- a/xen/include/acpi/actables.h +++ b/xen/include/acpi/actables.h @@ -99,7 +99,7 @@ acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length); void acpi_tb_install_table(acpi_physical_address address, - u8 flags, char *signature, acpi_native_uint table_index); + u8 flags, const char *signature, acpi_native_uint table_index); acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags); diff --git a/xen/include/acpi/acutils.h b/xen/include/acpi/acutils.h index b1b0df758b..ac54adaa8c 100644 --- a/xen/include/acpi/acutils.h +++ b/xen/include/acpi/acutils.h @@ -164,7 +164,7 @@ acpi_ut_debug_print(u32 requested_debug_level, u32 line_number, const char *function_name, const char *module_name, - u32 component_id, char *format, ...) ACPI_PRINTF_LIKE(6); + u32 component_id, const char *format, ...) ACPI_PRINTF_LIKE(6); void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw(u32 requested_debug_level, @@ -172,24 +172,24 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, const char *function_name, const char *module_name, u32 component_id, - char *format, ...) ACPI_PRINTF_LIKE(6); + const char *format, ...) ACPI_PRINTF_LIKE(6); void ACPI_INTERNAL_VAR_XFACE acpi_ut_error(const char *module_name, - u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3); + u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); void ACPI_INTERNAL_VAR_XFACE acpi_ut_exception(const char *module_name, u32 line_number, - acpi_status status, char *format, ...) ACPI_PRINTF_LIKE(4); + acpi_status status, const char *format, ...) ACPI_PRINTF_LIKE(4); void ACPI_INTERNAL_VAR_XFACE acpi_ut_warning(const char *module_name, - u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3); + u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); void ACPI_INTERNAL_VAR_XFACE acpi_ut_info(const char *module_name, - u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3); + u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); /* * utmisc diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h index 352f27f6a7..8ec9579172 100644 --- a/xen/include/xen/acpi.h +++ b/xen/include/xen/acpi.h @@ -81,12 +81,12 @@ int erst_init(void); void acpi_hest_init(void); int acpi_table_init (void); -int acpi_table_parse(char *id, acpi_table_handler handler); -int acpi_parse_entries(char *id, unsigned long table_size, +int acpi_table_parse(const char *id, acpi_table_handler handler); +int acpi_parse_entries(const char *id, unsigned long table_size, acpi_table_entry_handler handler, struct acpi_table_header *table_header, int entry_id, unsigned int max_entries); -int acpi_table_parse_entries(char *id, unsigned long table_size, +int acpi_table_parse_entries(const char *id, unsigned long table_size, int entry_id, acpi_table_entry_handler handler, unsigned int max_entries); struct acpi_subtable_header *acpi_table_get_entry_madt(enum acpi_madt_type id, unsigned int entry_index); -- generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |