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

Re: [PATCH] xen/cpu: Fix MISRA C 2012 Rule 20.7 violation


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 5 Aug 2022 10:58:12 +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=LqU+19+UTeOijz/zjWTwxXmWEbbRKExSixiLHgOID4k=; b=fOGfaKNDbPVRlnBa5UkM4eppiBeNixYACmRU623mv9T5eYP94NbXRrCqkcII5+bqs5h1U9PTR1+FG1h5d6L6OJHIHan3ehi2cxDMK7SjphCoGMnI3g3m/VkRwqRRoy1p2Whs3vCLaq84qu+hXBl20G7ZksgkpcY88aWTRtSNQdif2ayaZ7zqIrsbPNp+YkU1Vn06BxDRDobCoSQX8JE6GvAIeTOKui2fXF0ehadvc5qDSnmm1g+aE3nwY4+I/1W9tKj7oJLZGIHpeI98m4VJa7AkrjzvUikpMbPD0LuoKFJTn7wsUZJxdsEDdHCxHGjwU5L8oo8FX7vix7IvscRkhg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QIfi6wU4G7zUubCtKq31qbH8KzIKtHXTGRh+gZm4zca+4FwQtv2iYkerdmPSNBdG3YScsRSsZdSqanNyzvqFvFHx92mbynrrNDL7KefWhMxJ0k12mrDGlvBJzPpXnsYlvCQZdaJtJXf5BmDMXdg4ak8Wu003BlJbjxd3p7O+v+pMKzzzqssW4n8ydizMB7QJg2sxW0zfBvLwM4VvQKfcVBpp22zVpvwDU20fX7HnbeFeJXyXHl+tsxvTAKw1SOhtB/UR4XiAj+sttadFRTL6HA0JH0lk0wUChOqtLKZBQHwhGUpXyNJYi0pX4Ihce26c6u4J4zbRhSvZA6M6JKu7XQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 05 Aug 2022 08:58:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05.08.2022 10:43, Xenia Ragiadakou wrote:
> --- a/xen/common/cpu.c
> +++ b/xen/common/cpu.c
> @@ -25,7 +25,7 @@ const cpumask_t cpumask_all = {
>   */
>  
>  /* cpu_bit_bitmap[0] is empty - so we can back into it */
> -#define MASK_DECLARE_1(x) [x+1][0] = 1UL << (x)
> +#define MASK_DECLARE_1(x) [(x)+1][0] = 1UL << (x)

If you adjust these, you also ...

>  #define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1(x+1)
>  #define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2(x+2)
>  #define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4(x+4)

.. want to adjust all of these, as they all have a similar issue.
And while doing such adjustments, please also add the missing blanks
around + .

However, these are macros used locally in a single .c file only, so
I'm not convinced as strict rules need to apply here. To make clear
no further uses (farther apart from the macro definitions) are
intended, an option would be to add #undef-s right after
cpu_bit_bitmap[]'s initializer. (But this is not an objection to
adding the parentheses, just a general remark.)

Jan



 


Rackspace

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