[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: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Wed, 1 May 2024 06:57:37 +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=/HJA8n3NJ/TQmyBEtz7L3kCXnOjOxKdWvuquyWUVvJA=; b=mfQ9EsjiRB8d9GJZZ6H/xWU8UnH17wpWIRVJvqUkUiiM4zakAWO4MRM6p2mM1vC0Jd/2aJ0qlQTXnPwMdMXcbMgEeCKLmAXAR/jr+dp7nLthcGFTiRoSF0h8HMlbD3ImgP8Yanm7PdMPRgeBkJy4OPly+uXrLJjkLXtnKPqobk2yxFCZ2WfLpom2JlzhVkdx+SdPwFQlNMdcE5JZ9m/ASs4GW5kyOV7pmYVzRPHYllXmDXSqSQRbmaCRhYVIcvKCyLlC8ydti/U9wW1pxWnyZhWhQttTi7LTOiP90B2lAD6yiYEA0d6BKzxgTM03VzR838Q+ThX+PcJSXGzJCfuvMA==
  • 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=/HJA8n3NJ/TQmyBEtz7L3kCXnOjOxKdWvuquyWUVvJA=; b=G8DM8CdrlAs6VSM3LtQF/H4WCihyLTbsd4v5PFpKdkaHuZf36v6nNQPQbwCeQLuCRevatsPN5HLvqZtvJ3KvzMfgm4DNJE0ESSYydIYRieoH/U/BbBGs04xa4je9DdU1xfwg+Bj/1V4SV4SnGiPJ2JCm8a7QCUgWr+A9Yxb80s+Wwg1/8J5v8Id2/3pkjSz3Kd05/qlY5ldkF5UCQ8ZykuSgXZ0ybgR0FF3CSq2Phovn7hk1+nRtaXvuzoQxZgN1vUt+HtRVlhT/XcUSHhoJJvXp+gO9jl1t/yeY1nf/WX1CmLh8saJg3wumuWMvgnOaNNb8kQ8usmObivVp5OYY8A==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Sna6tCkGh7DLQdQ7GHmLTl/BhZFDJ42+SpZiUPjrZIsoPGxIvso9x5UQA/SxSVy/81kV5H+j4xPymZXILdS0C1gPPP1JydCqvwZMcnB/4mwJrvYB2nYc09QwzbL7Xfj7rXh5QzqfcsBlf+5NcfoWtWexMv7wmKOXFCiQpw5fENAcYvt3hhey2REevBP92v/SnetuQXYvQVVbwHip8Vg0I2QScZzHkD5oHzGB+3cOW+VyQz/xEjFvjI2ZXmFvXQhniFJ4Q36f7eJQyD4zmd/xYDQCS+khkcdpQkHvpVFWYSTZPKYEmUusxFKKrtzw400ciW8fOPfUHia0FhSAQgElBg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FeUEljIv1IBl6+GEw/LMNCcA02hFy44d5v44mbnG04SVAR5YyKl2diK7r0UQrVO4/BdWIOtHuCWWI1nXzSJ0qWXb6eD0RBDYnsjS5MFrq67QNf47oOb3jueP4koy/O7e42TX5b7fSXGLC1lomwOS99PgsGaKs8U9wB6VXALr1q/YmGQohJVpQ7SH4NGw18eCzyyGKAo1zF9EbSy1bc1nLc1NhjsHEWnJ5m69zUlHMxK/d357+JTn2jZXZQAFs+g3EXPQ9KMW7vlrL0G9wTcoCUugO+W6bWlTokdlsM4+EEdzgyXaPjLTt1VqrWOOWZ0UVJSugcgyFtj/LCLl98EfTg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "consulting @ bugseng . com" <consulting@xxxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 01 May 2024 06:58:13 +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: AQHamu72Eq1RpEGs60mNp9DIfY8mn7GAr6+AgAFEGQA=
  • Thread-topic: [PATCH 2/2] xen/arm: Fix MISRA regression on R1.1, flexible array member not at the end

Hi Jan,

> On 30 Apr 2024, at 12:37, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 30.04.2024 13:09, Luca Fancellu wrote:
>> --- a/xen/arch/arm/include/asm/setup.h
>> +++ b/xen/arch/arm/include/asm/setup.h
>> @@ -64,18 +64,20 @@ struct membank {
>> };
>> 
>> struct membanks {
>> -    unsigned int nr_banks;
>> -    unsigned int max_banks;
>> +    __struct_group(membanks_hdr, common, ,
>> +        unsigned int nr_banks;
>> +        unsigned int max_banks;
>> +    );
>>     struct membank bank[];
>> };
> 
> I'm afraid I can't spot why __struct_group() is needed here. Why would just
> one of the two more straightforward
> 
> struct membanks {
>    struct membanks_hdr {
>        unsigned int nr_banks;
>        unsigned int max_banks;
>    );
>    struct membank bank[];
> };
> 

At the first sight I thought this solution could have worked, however GCC 
brought me back down to earth
remembering me that flexible array members can’t be left alone in an empty 
structure:

/data_sdc/lucfan01/gitlab_mickledore_xen/xen/xen/arch/arm/include/asm/setup.h:70:6:
 error: declaration does not declare anything [-Werror]
70 | };
| ^
/data_sdc/lucfan01/gitlab_mickledore_xen/xen/xen/arch/arm/include/asm/setup.h:71:20:
 error: flexible array member in a struct with no named members
71 | struct membank bank[];
| ^~~~
[...]

Cheers,
Luca


 


Rackspace

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