[PATCH v2] xen/arm: efi-boot misra rule 4.1 fix

Stefano Stabellini posted 1 patch 1 year, 5 months ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20221209222552.3353993-1-sstabellini@kernel.org
xen/arch/arm/efi/efi-boot.h | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
[PATCH v2] xen/arm: efi-boot misra rule 4.1 fix
Posted by Stefano Stabellini 1 year, 5 months ago
We have 3 violations of MISRA C Rule 4.1 ("Octal and hexadecimal escape
sequences shall be terminated") in xen/arch/arm/efi/efi-boot.h. Fix them
and take the opportunity to declare them as static const __initconst and
improve the style.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
Changes in v2:
- add static const __initconst
- add blank newline for style
---
 xen/arch/arm/efi/efi-boot.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index 43a836c3a7..223db0c4da 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -542,7 +542,9 @@ static void __init efi_arch_handle_module(const struct file *file,
 
     if ( file == &ramdisk )
     {
-        char ramdisk_compat[] = "multiboot,ramdisk\0multiboot,module";
+        static const char __initconst ramdisk_compat[] = "multiboot,ramdisk\0"
+                                                         "multiboot,module";
+
         node = fdt_add_subnode(fdt, chosen, "ramdisk");
         if ( node < 0 )
             blexit(L"Unable to add ramdisk FDT node.");
@@ -555,7 +557,9 @@ static void __init efi_arch_handle_module(const struct file *file,
     }
     else if ( file == &xsm )
     {
-        char xsm_compat[] = "xen,xsm-policy\0multiboot,module";
+        static const char __initconst xsm_compat[] = "xen,xsm-policy\0"
+                                                     "multiboot,module";
+
         node = fdt_add_subnode(fdt, chosen, "xsm");
         if ( node < 0 )
             blexit(L"Unable to add xsm FDT node.");
@@ -568,7 +572,9 @@ static void __init efi_arch_handle_module(const struct file *file,
     }
     else if ( file == &kernel )
     {
-        char kernel_compat[] = "multiboot,kernel\0multiboot,module";
+        static const char __initconst kernel_compat[] = "multiboot,kernel\0"
+                                                        "multiboot,module";
+
         node = fdt_add_subnode(fdt, chosen, "kernel");
         if ( node < 0 )
             blexit(L"Unable to add dom0 FDT node.");
-- 
2.25.1
Re: [PATCH v2] xen/arm: efi-boot misra rule 4.1 fix
Posted by Julien Grall 1 year, 5 months ago
Hi Stefano,

On 09/12/2022 22:25, Stefano Stabellini wrote:
> We have 3 violations of MISRA C Rule 4.1 ("Octal and hexadecimal escape
> sequences shall be terminated") in xen/arch/arm/efi/efi-boot.h. Fix them
> and take the opportunity to declare them as static const __initconst and
> improve the style.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,

-- 
Julien Grall
Re: [PATCH v2] xen/arm: efi-boot misra rule 4.1 fix
Posted by Julien Grall 1 year, 5 months ago

On 11/12/2022 11:10, Julien Grall wrote:
> Hi Stefano,
> 
> On 09/12/2022 22:25, Stefano Stabellini wrote:
>> We have 3 violations of MISRA C Rule 4.1 ("Octal and hexadecimal escape
>> sequences shall be terminated") in xen/arch/arm/efi/efi-boot.h. Fix them
>> and take the opportunity to declare them as static const __initconst and
>> improve the style.
>>
>> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Reviewed-by: Julien Grall <jgrall@amazon.com>

Committed.

Cheers,

-- 
Julien Grall