[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


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 24 Oct 2023 16:56:14 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rbGcT1DsOGDZZbzoM4yu+8Gw+XJ2neSKl2FpYfLoSEs=; b=cgJ9V9gHR44dyHghzx0OHRmtu2ca23Sj7Hd1RGBU8iahG+Xb591zDDT8jGYOL+eeS4IEHpQnWrMLo5M6OyapvuLr3Gcp3fuvEjWnp41zfZ4I8BWD5SN0phEqwfOTEN7znBHZ2AZ/LSXHkIYA0bq56kyU7olC1iIF58lKI45Bp1baYWu/BoCaOGj5c9nGz6cbGrIhMbxI+rYB7rltDTZlzDOYVjFNN6PgHgx4BeIq1f+FqGWGtW+mq2nmhdXYlPk/wfvi3Rws7YwjvyO3Cg6zbc2fdr1Uwl7nBzY3AJplqWHXhjNkLuMO4CaMwPC1YvlUOl1vrLgdZDS5p2ns07mk7g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=inNbj1/TYFSXZQdDnHCDUqAPChuzM8Cn+pdhotSNFZeQIb05LSsg2nNs7rpWW+6BP675Wxiu/FPiFtEftgyU77USh3u53n9tC1Ed3ni6tuIFabQgve7az2Xe9qWLofiWoKpJlNoB5TucCqOg7eumLiYyVvil/ho0alAU6rBLc7hEtUKvmcnDMp+cp93yr0GyDkb3g5FEnzPJZGv9pk5SVpkLjhZahA97LQzx5+oE0q8GOspetsdZR2OmgxznlAOy16pwMPpC//WPrDrtO+VTrSTx7Z7zMu02P2dR0M0t5ySM/H4+HSM0HTNdzdvtDRjjtneLpkODONEo7/HznpqTMQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 24 Oct 2023 14:56:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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



 


Rackspace

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