@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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);
@@ -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
@@ -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);
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@citrix.com> --- CC: George Dunlap <George.Dunlap@eu.citrix.com> CC: Jan Beulich <JBeulich@suse.com> CC: Stefano Stabellini <sstabellini@kernel.org> CC: Wei Liu <wl@xen.org> CC: Julien Grall <julien@xen.org> CC: Roberto Bagnara <roberto.bagnara@bugseng.com> CC: Nicola Vetrini <nicola.vetrini@bugseng.com> --- 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(-)