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

Re: [XEN PATCH] xen: fixed violations of MISRA C:2012 Rule 3.1


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 13 Jun 2023 10:27:30 +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=2HUEguW/FfPGBupJkfWirwFWRZBhnTtryxy/BgWwOso=; b=UsDMDX6u48jnxDUME57JD0ClJRg6xebjJmalEAF0JxhuctbU9BbOdjSJ7Y8qRxrgE7cfLdQxouDp52QO406yny0wZOAm113XCE15cXBjoxWs94XpyuKhsW4Z4fPSzTE1sIiGbjAs3rNIRli6yLQ/FFpanlnzgV2HpWRvAmcJN3HwFD5C6szy0vGJq8etYYeZIjWouMZn77mr0mCsnKEkBxwYF0VtJjHWGv4v8QKoOQHO5OLfzPMrRm8IWuOwdRPRGMFrSOIReVWdlwEU7QIfaz5jE0OvQyLstsY8tCpQNpeVQ/GTQyTWyjbWsj4GQJjRnMpMotSMpAvQupQs+AgDFQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DKqaz6MWQA4N34ytIGKpnMdgfP4Fl41aw/BRZaiqK7hcNEiMic2RWqic9BP/Y5OpfO698JpN06RDFBsReBhHHG3x86lTBt7wnTx/FWqqq4h+Fewbtg5GPL1WmXbeR5jQ+cRgySKE4PInkpB1jsOktgi7zbzW855aL4HEB14juhLzNwbjk4OOIegFe3wCRmfiHHEtWHBWC2yq+8w5RqziE265gXs0HjIBI7IQEhjcUy9a6v0jzfdaZ8auNuFk1p0pd9/zXquOl47d/vcIAJZYwtmlwSbI4ioCqU0gdxbJCwJhRdOEMoJbCXBqxtdAh/fDtTkwluPKGMj02bgvYmYx1Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: consulting@xxxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 13 Jun 2023 08:28:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.06.2023 09:42, Nicola Vetrini wrote:
> The xen sources contain several violations of Rule 3.1 from MISRA C:2012,
> whose headline states:
> "The character sequences '/*' and '//' shall not be used within a comment".
> 
> Most of the violations are due to the presence of links to webpages within
> C-style comment blocks, such as:
> 
> xen/arch/arm/include/asm/smccc.h:37.1-41.3
> /*
>  * This file provides common defines for ARM SMC Calling Convention as
>  * specified in
>  * http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
>  */
> 
> In this case, we propose to deviate all of these occurrences with a
> project deviation to be captured by a tool configuration.
> 
> There are, however, a few other violations that do not fall under this
> category, namely:
> 
> 1. in file "xen/arch/arm/include/asm/arm64/flushtlb.h" we propose to
> avoid the usage of a nested comment;
> 2. in file "xen/common/xmalloc_tlsf.c" we propose to substitute the
> commented-out if statement with a "#if 0 .. #endif;
> 3. in file "xen/include/xen/atomic.h" and
> "xen/drivers/passthrough/arm/smmu-v3.c" we propose to split the C-style
> comment containing the nested comment into two doxygen comments, clearly
> identifying the second as a code sample. This can then be captured with a
> project deviation by a tool configuration.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
> ---
> Changes:
> - Resending the patch with the right maintainers in CC.

But without otherwise addressing comments already given, afaics. One more
remark:

> --- a/xen/common/xmalloc_tlsf.c
> +++ b/xen/common/xmalloc_tlsf.c
> @@ -140,9 +140,10 @@ static inline void MAPPING_SEARCH(unsigned long *r, int 
> *fl, int *sl)
>          *fl = flsl(*r) - 1;
>          *sl = (*r >> (*fl - MAX_LOG2_SLI)) - MAX_SLI;
>          *fl -= FLI_OFFSET;
> -        /*if ((*fl -= FLI_OFFSET) < 0) // FL will be always >0!
> -         *fl = *sl = 0;
> -         */
> +#if 0
> +        if ((*fl -= FLI_OFFSET) < 0) // FL will be always >0!
> +        fl = *sl = 0;

You want to get indentation right here, and you don't want to lose
the indirection on fl.

> +#endif
>          *r &= ~t;
>      }
>  }

If you split this to 4 patches, leaving the URL proposal in just
the cover letter, then I think this one change (with the adjustments)
could go in right away. Similarly I expect the arm64/flushtlb.h
change could be ack-ed right away by an Arm maintainer.

Jan



 


Rackspace

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