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

Re: [RFC 2/4] x86/shutdown: address MISRA C:2012 Rule 9.3



On 24/10/2023 16:56, Jan Beulich wrote:
On 24.10.2023 16:31, Nicola Vetrini wrote:
@@ -225,8 +225,8 @@ static const struct dmi_system_id __initconstrel reboot_dmi_table[] = {
         .ident = "Dell OptiPlex 745",
         .matches = {
             DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
-            DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"),
-            DMI_MATCH(DMI_BOARD_NAME, "0MM599"),
+            [0] = DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"),
+            [1] = DMI_MATCH(DMI_BOARD_NAME, "0MM599")
         },
     },
{ /* Handle problems with rebooting on Dell Optiplex 745 with 0KW626 */ @@ -235,8 +235,8 @@ static const struct dmi_system_id __initconstrel reboot_dmi_table[] = {
         .ident = "Dell OptiPlex 745",
         .matches = {
             DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
-            DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"),
-            DMI_MATCH(DMI_BOARD_NAME, "0KW626"),
+            [0] = DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"),
+            [1] = DMI_MATCH(DMI_BOARD_NAME, "0KW626")
         },
     },
{ /* Handle problems with rebooting on Dell Optiplex 330 with 0KP561 */ @@ -245,8 +245,8 @@ static const struct dmi_system_id __initconstrel reboot_dmi_table[] = {
         .ident = "Dell OptiPlex 330",
         .matches = {
             DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
-            DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 330"),
-            DMI_MATCH(DMI_BOARD_NAME, "0KP561"),
+            [0] = DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 330"),
+            [1] = DMI_MATCH(DMI_BOARD_NAME, "0KP561")
         },
     },
{ /* Handle problems with rebooting on Dell Optiplex 360 with 0T656F */ @@ -255,8 +255,8 @@ static const struct dmi_system_id __initconstrel reboot_dmi_table[] = {
         .ident = "Dell OptiPlex 360",
         .matches = {
             DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
-            DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 360"),
-            DMI_MATCH(DMI_BOARD_NAME, "0T656F"),
+            [0] = DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 360"),
+            [1] = DMI_MATCH(DMI_BOARD_NAME, "0T656F")
         },
     },
{ /* Handle problems with rebooting on Dell OptiPlex 760 with 0G919G */ @@ -265,8 +265,8 @@ static const struct dmi_system_id __initconstrel reboot_dmi_table[] = {
         .ident = "Dell OptiPlex 760",
         .matches = {
             DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
-            DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 760"),
-            DMI_MATCH(DMI_BOARD_NAME, "0G919G"),
+            [0] = DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 760"),
+            [1] = DMI_MATCH(DMI_BOARD_NAME, "0G919G")
         },
     },
     {    /* Handle problems with rebooting on Dell 2400's */

Well, no, this is what absolutely should not happen: You're breaking
the code here, but initializing slot 0 twice in multiple instances.
From looking just at the patch I probably wouldn't have noticed, but
the "always elements 0 and 1 only" pattern made me "grep -lr", where
the issue became apparent. Otherwise I was about to suggest we shrink
array size to just 2 elements.

Jan

Right, that was a shortcoming of my regex.

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



 


Rackspace

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