[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/ACPI: Use const char * for string literals



Hi Andrew,

On 14/07/2023 14:10, Andrew Cooper wrote:
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>


I had a similar patch in my queue. But never sent as I didn't know whether it would be accepted. This was one of the major blocker for switching the hypervisor to use const string.

Acked-by: Julien Grall <jgrall@xxxxxxxxxx>

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.