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

Re: [PATCH 2/2] xen/arm: Fix MISRA regression on R1.1, flexible array member not at the end


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Wed, 8 May 2024 16:18:07 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=4OH/AvRmA/KmgVttKawV+T8DCYZ/F9UF7C3uLjcrtSM=; b=f5jjZrp7OJUfkpIB7E+gj1sqE74w5V0aUKGLInodXgDFVg1PMa79ct+kXQW3u/QMB9P1ibMi8ahwTkbBRj4uMVp7Q0u5QcQT23nKMPTyCJ0KUmuG1eOz4hF9hYc8xxF3YWH/25eBIBJdJixSD8D90eRuVWyeM2ECtv01h7H/4MwjNUd2CBpdgO8oI/XZbBHWidk1nFgZ2oj4KSpFX3o9GMgH7RlBLz8UZJZTtMI4tjulraXHiyjwHabzEfVZidOBp/DPGT/W2JUS2ZjXFe7R5a1Gd53uGFIX4Yj/ivV83wCZraReOzcgfapcKUAdruXsWMrTXVHX3TCArSIdLLIMqQ==
  • 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=4OH/AvRmA/KmgVttKawV+T8DCYZ/F9UF7C3uLjcrtSM=; b=NtRbUN0YrZ84LKLxYPXwiJtDW8y6TPE9xiJBBMi2+51zccaftTGrvM8IhGn8XL3j2xYmu5Iy/pvQNs98q8vl7yb65HlMN/npgLl+gFfItHX/4U8FgtpP5h0ZP9zgogPwpvmLVFMiTOQiHQznIpql9W65YF2VZ+sI3q4MVUVvBGliVmFcQuVc5bXJ60PYxQr4U3V9sbRZHmlf4F9S0gCIBG4JVATWC4F9Hg7k41M2Z+oZaYq6ALgROYj2uJNp8E8KV7TNv/SWimP3Rd40RWCNLZq0T9zde/HYR6xwBHKy3OTr9wgdfL+7ODeWm01K5hXlLU2jMpddSvtGLCfdFlisDg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ehqDRoyvk1S5vnKayQOFW5CSmDeCzdsY9Ms6OnY3SN2SN7eR22YgvupqtieehHiZ+aP4qj1QzHLUs2+VLAMKAuiIpjrdVEdgjhk/C43U8gAwkrnTqsgV1tsDS7ULCCZEGiMNPSR/JQg4NuWDUHrBj2PkLGzop+q2xqlbP0FV/K2s95EQM57a/OtIZgvC5MZEe36crcsKKOl/KlEF2AZ70pxBSJHLjW7mrQhwiA01CW5V2qolQQW1A6iWCzxrN1+VSaicXcLK9cNeY97wD4Bwqlgsza5RhOis3MWNAf+BRusKjqh23NWDwiXaApskTOIMyMlGL+E52+dCGz4PhY9E7Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kv0rrcI3neHORlyJso6NAX2zrYVidb35zkJgI/eVipSkzJpejVcivYqcLq/qoPdQnCk9wQMs2zhbygXry8Lu8Z85ya+7ewEO4J0LbWzeEGyS05kdR7cIOC7xGHHfsZnptgFXjvIPL9xsgm5DtdCedPNTy5E8KFvSeQN0qDVX2/BSNl+MCawJcgru+VJpry6iPxNupYmTsl6h7J4Dkt8taoFXxslIq7RnV3slIim9FimuXvT8qwZx8bRudu+fptOCto19PhRFuu1/0CqmFqYlHv9bqu3XYnyfYoBqNpUYKvjlgkTX+y0DFPlbmNz9u4BIEZrqhAvpTN6SvSJszuFkFQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "consulting @ bugseng . com" <consulting@xxxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 08 May 2024 16:18:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHamu72Eq1RpEGs60mNp9DIfY8mn7GESRmAgAlHnIA=
  • Thread-topic: [PATCH 2/2] xen/arm: Fix MISRA regression on R1.1, flexible array member not at the end


> On 2 May 2024, at 19:35, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> On Tue, 30 Apr 2024, Luca Fancellu wrote:
>> Commit 2209c1e35b47 ("xen/arm: Introduce a generic way to access memory
>> bank structures") introduced a MISRA regression for Rule 1.1 because a
>> flexible array member is introduced in the middle of a struct, furthermore
>> this is using a GCC extension that is going to be deprecated in GCC 14 and
>> a warning to identify such cases will be present
>> (-Wflex-array-member-not-at-end) to identify such cases.
>> 
>> In order to fix this issue, use the macro __struct_group to create a
>> structure 'struct membanks_hdr' which will hold the common data among
>> structures using the 'struct membanks' interface.
>> 
>> Modify the 'struct shared_meminfo' and 'struct meminfo' to use this new
>> structure, effectively removing the flexible array member from the middle
>> of the structure and modify the code accessing the .common field to use
>> the macro container_of to maintain the functionality of the interface.
>> 
>> Given this change, container_of needs to be supplied with a type and so
>> the macro 'kernel_info_get_mem' inside arm/include/asm/kernel.h can't be
>> an option since it uses const and non-const types for struct membanks, so
>> introduce two static inline, one of which will keep the const qualifier.
>> 
>> Given the complexity of the interface, which carries a lot of benefit but
>> on the other hand could be prone to developer confusion if the access is
>> open-coded, introduce two static inline helper for the
>> 'struct kernel_info' .shm_mem member and get rid the open-coding
>> shm_mem.common access.
>> 
>> Fixes: 2209c1e35b47 ("xen/arm: Introduce a generic way to access memory bank 
>> structures")
>> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>

Hi Stefano,

Thanks!

Is it possible to add, eventually on commit, this tag?

Reported-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>





 


Rackspace

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