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

Re: [XEN PATCH 2/4] x86/mtrr: address MISRA C:2012 Rule 5.3


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 3 Aug 2023 10:41:51 +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=3O1vSwflEAE9qOo/cmIsG9F6LMui8WCEtFaeweP8yEo=; b=R+FYtC5Sje9k7PXSAzYVx9utIcxoEMSikQaoElPSPEjpxVwQvPzhfxoQfBBrtdaRYboWmZ/izX6WdSwtDVR5jysZmQTVjVT4C/+2Z6yZqvR7l7sqQfLNTZUVLE4PI0k9x/Q5JVHFHhtyqE0loZAA+CkRVP6ewzxN4Uaw5fneQ6dgDDgWpHQ7anb0O/ceybMsPXMNxq9bErU126Dw0+kNMN/8hSGsro2PQjEvdtMY2hZbmlEyW3bIfhoHEoe/Rl0NSHj+0YusOIMIC9ELDrPuU0qgp/baK7vArQscqd2dJipyzw3F4IQT8tAObHkKIcODWNr4A7Jc7PiLbHTjZczLtg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e4g41+gvolXteh4lu96LCzOh+jH7vUgMYcYo72e8zT7/cPmugqNppkmE8UejuQxNZL7jF+1W6iH79TvtzV20dUWPoDAvIniACM4CGDqnVREa7b5Wo+QjXovetClJ9nkxKB6rrT13q/2+CYFMIAjQcRdAUfQ/1Qg6JESLgc0h+rHWJuy3FshRNXtp63pDfwbnhsaK69Fv/soeurSEh1DLc/eU2m2Uy9wZQyi5oOGniy5HJJQD3iuDEJSSvECT81nN1+/85F9EsRKqJe/DW8MloBDUu9/1Fzt1An0KrEoMiWepkxbM1Tw7wmMNombAx6GZqKw+wj/CXyk6bPNK4ejIeQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 03 Aug 2023 08:42:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.08.2023 03:51, Stefano Stabellini wrote:
> On Wed, 2 Aug 2023, Nicola Vetrini wrote:
>> --- a/xen/arch/x86/hvm/mtrr.c
>> +++ b/xen/arch/x86/hvm/mtrr.c
>> @@ -687,13 +687,13 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, 
>> uint64_t gfn_start,
>>  
>>  static int cf_check hvm_save_mtrr_msr(struct vcpu *v, hvm_domain_context_t 
>> *h)
>>  {
>> -    const struct mtrr_state *mtrr_state = &v->arch.hvm.mtrr;
>> +    const struct mtrr_state *mtrr = &v->arch.hvm.mtrr;
> 
> I can see in hvm_vcpu_cacheattr_init, mtrr_get_type and other places
> that we use:
> 
>   const struct mtrr_state *m
> 
> maybe that's better? I'll let Jan comment.

When unambiguous, personally I prefer shorter names (and as you say
existing code supports me in that). Obviously the longer a function,
the more potential future ambiguities also need taking into
consideration.

Jan



 


Rackspace

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