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

Re: [XEN PATCH 04/11] x86emul: move variable definitions to address MISRA C:2012 Rule 2.1


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 3 Aug 2023 11:09:28 +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=j8eveVOsOqlgiWdKX5XlNF3lqVszhPaGXVqKswy2xkU=; b=WZTDJNZ67h5eRe44aRzysFQ9N+b3InYJ0qoLcuZ+uOqgmLRgJEnhN7+6VDNayKhf35G3vUWL5UVNT1VULFMjmSbeCZELZTcB462NcyEk5lw2G2Xq4lCUH3VXr0890vCJ83/kT3TFK88QqM/7TglsS2WuvTC+xAbCBjxDkPBxTnPxQ8ZaOHhizthAig+ZasKnJ9bxXFDPDZZ2yQojKH70qY397nwy2Z7wy0KKv19dgK84V+kngwrf40Cmwg3AB0CD8kHX8nzG07CvueOJxySat1IeAmsxDVN5959MJ9zwZiGEqodCb7wBaw9cTfx6KI+7yRyoQneq3tbWJDd8WWtwXA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bQCsFwQA117si/FdDE+LP0fgHvRW6uPAo4uK3s5MzNKYtZl9S6wkg+nsHgjSqTNL1+soxtVuESRGJPKYgUcJqPcAajla2B5IlePXUh7nRsT6IApRJapaFLVi4eJLST8K02CSkZWXVNGpCAl8SXKMJ1h1lBZ1ippHL62M7DdurJMfYbCYmV656XooEFG5MnSVoLuNTHhzWnIXxuSrk5Bxv7DA7ZxRkhcRn5fVtj2M1F4hhxNv8DXRTTmrnrvOmNk7s/hNkvrxBoRW3V+901v8Bv6AGHjnJUd+ZhPYwMWEjfM87PXLGNC0XfbBzxvn0lLTlx42CxQkh6Xj+C+GyhENWQ==
  • 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, Paul Durrant <paul@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 03 Aug 2023 09:09:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.08.2023 04:33, Stefano Stabellini wrote:
> On Wed, 2 Aug 2023, Nicola Vetrini wrote:
>> @@ -2289,16 +2289,15 @@ static int cf_check hvmemul_cache_op(
>>      struct hvm_emulate_ctxt *hvmemul_ctxt =
>>          container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
>>      uint32_t pfec = PFEC_page_present;
>> +    unsigned long addr;
>> +    int rc;
>> +    void *mapping;
>>  
>>      if ( !cache_flush_permitted(current->domain) )
>>          return X86EMUL_OKAY;
>>  
>>      switch ( op )
>>      {
>> -        unsigned long addr;
>> -        int rc;
>> -        void *mapping;
> 
> These three could be...
> 
> 
>>      case x86emul_clflush:
>>      case x86emul_clflushopt:
>>      case x86emul_clwb:
> 
> ... here in a new block

Except they're likely to be re-used as new enumerators are added.

>> --- a/xen/arch/x86/x86_emulate/util-xen.c
>> +++ b/xen/arch/x86/x86_emulate/util-xen.c
>> @@ -77,10 +77,10 @@ bool cf_check x86_insn_is_portio(const struct 
>> x86_emulate_state *s,
>>  bool cf_check x86_insn_is_cr_access(const struct x86_emulate_state *s,
>>                                      const struct x86_emulate_ctxt *ctxt)
>>  {
>> +    unsigned int ext;
>> +
>>      switch ( ctxt->opcode )
>>      {
>> -        unsigned int ext;
> 
> This can go under case X86EMUL_OPC with a new block

Same here.

Jan



 


Rackspace

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