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

Re: [XEN PATCH v2] xen/set_{c,p}x_pminfo: address violations od MISRA C:2012 Rule 8.3


  • To: Federico Serafini <federico.serafini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 31 Oct 2023 09:38:01 +0100
  • 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=UuC8T6P3mH03w5RWnjiWLqRLF+9j1EwWQ98JzWr2m8g=; b=kMLokaLIS+Px+kWhIKbV+DAgsnrQOBI/DeXgoEAlJ9gkzxke4Sk8YS6yh37GELvtC8NlH/FWfvg/dOAls1+cECL1Cl+f2NP4FXQ/xCq0/aIk29e4x+fqDclb+2gqNSo5I2RFLkZnJE7wCxQdOhrQlE2+P7VpF4FTdzB8KAQf1nhCg8ZveaBnUV0Rf3ckvqUDfn1m8O96R+rrjjHJT45jZG6YRXICcshfpbA8e/gUZDhC2KDxmFxCCPU/0r/P8htjmLXEDPaIHzQSNyEbLXkUvy5TCCJA75qR9fwyWdPt8JcaWsorrDsdjoYirgf/6abKX8dJswgp6CNlA8VbtHrLtg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ENwmxbPPi8oN9luK45QfMdcTXAJIdWYCJgMc7PHHqR5+NxB3+xH6oN7SDPfgw8k86HG/yjple3PnIf/WAKeqbmlVtHAmBVHWuE+QqFa6mPkJnU4R5k+kYnEGNmqG+8bBaON29bQziCa5HYqQsNQOUotYWcrt+Ak0kqaQ0KfVUHPx1jqexPpKRJYehu5sn2/bGj/XG7pF2xjbN6VH6Hg1RqocKWNKkeipR7lYa6REibT5tJoEW89Z4BXqWrFLqzuO5gV7VmBbVgcO6p7hOE0oGLC0652+0+dXEjilPmeSkBn2Ll+ZiHpHNQmc1sgb5dzM9Di9lP/cOJ1dBE8unenN/A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 31 Oct 2023 08:38:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 31.10.2023 09:33, Federico Serafini wrote:
> Make function definitions and declarations consistent.
> No functional change.
> 
> Signed-off-by: Federico Serafini <federico.serafini@xxxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

> @@ -488,22 +488,22 @@ int set_px_pminfo(uint32_t acpi_id, struct 
> xen_processor_performance *dom0_px_in
>      pmpt->acpi_id = acpi_id;
>      pmpt->id = cpuid;
>  
> -    if ( dom0_px_info->flags & XEN_PX_PCT )
> +    if ( perf->flags & XEN_PX_PCT )
>      {
>          /* space_id check */
> -        if (dom0_px_info->control_register.space_id != 
> -            dom0_px_info->status_register.space_id)
> +        if ( perf->control_register.space_id !=
> +             perf->status_register.space_id )
>          {
>              ret = -EINVAL;
>              goto out;
>          }
>  
> -        memcpy ((void *)&pxpt->control_register,
> -                (void *)&dom0_px_info->control_register,
> -                sizeof(struct xen_pct_register));
> -        memcpy ((void *)&pxpt->status_register,
> -                (void *)&dom0_px_info->status_register,
> -                sizeof(struct xen_pct_register));
> +        memcpy((void *)&pxpt->control_register,
> +               (void *)&perf->control_register,
> +               sizeof(struct xen_pct_register));
> +        memcpy((void *)&pxpt->status_register,
> +               (void *)&perf->status_register,
> +               sizeof(struct xen_pct_register));

Along with the other coding style changes it might have been nice to
also drop the bogus casts here and ...

> @@ -512,69 +512,67 @@ int set_px_pminfo(uint32_t acpi_id, struct 
> xen_processor_performance *dom0_px_in
>          }
>      }
>  
> -    if ( dom0_px_info->flags & XEN_PX_PSS ) 
> +    if ( perf->flags & XEN_PX_PSS )
>      {
>          /* capability check */
> -        if (dom0_px_info->state_count <= 1)
> +        if ( perf->state_count <= 1 )
>          {
>              ret = -EINVAL;
>              goto out;
>          }
>  
>          if ( !(pxpt->states = xmalloc_array(struct xen_processor_px,
> -                        dom0_px_info->state_count)) )
> +                                            perf->state_count)) )
>          {
>              ret = -ENOMEM;
>              goto out;
>          }
> -        if ( copy_from_guest(pxpt->states, dom0_px_info->states,
> -                             dom0_px_info->state_count) )
> +        if ( copy_from_guest(pxpt->states, perf->states, perf->state_count) )
>          {
>              ret = -EFAULT;
>              goto out;
>          }
> -        pxpt->state_count = dom0_px_info->state_count;
> +        pxpt->state_count = perf->state_count;
>  
>          if ( cpufreq_verbose )
>              print_PSS(pxpt->states,pxpt->state_count);
>      }
>  
> -    if ( dom0_px_info->flags & XEN_PX_PSD )
> +    if ( perf->flags & XEN_PX_PSD )
>      {
>          /* check domain coordination */
> -        if (dom0_px_info->shared_type != CPUFREQ_SHARED_TYPE_ALL &&
> -            dom0_px_info->shared_type != CPUFREQ_SHARED_TYPE_ANY &&
> -            dom0_px_info->shared_type != CPUFREQ_SHARED_TYPE_HW)
> +        if ( perf->shared_type != CPUFREQ_SHARED_TYPE_ALL &&
> +             perf->shared_type != CPUFREQ_SHARED_TYPE_ANY &&
> +             perf->shared_type != CPUFREQ_SHARED_TYPE_HW )
>          {
>              ret = -EINVAL;
>              goto out;
>          }
>  
> -        pxpt->shared_type = dom0_px_info->shared_type;
> -        memcpy ((void *)&pxpt->domain_info,
> -                (void *)&dom0_px_info->domain_info,
> -                sizeof(struct xen_psd_package));
> +        pxpt->shared_type = perf->shared_type;
> +        memcpy((void *)&pxpt->domain_info,
> +               (void *)&perf->domain_info,
> +               sizeof(struct xen_psd_package));

... here. If I end up committing this, I may take the liberty to do so.

Jan



 


Rackspace

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