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

Re: [RFC 1/4] x86/ioemul: address MISRA C:2012 Rule 9.3


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 13 Nov 2023 08:49:14 +0100
  • 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=13evBTS3gLDxiaQDp6lh28J08Wm9BN39xCzkv5i+jEk=; b=oSQIhytHHMLjFsk2pSETOE6THztNyjvqIFCxWO4rJ410pTwQDMxfbWaC4/Nr7cvl1hrqzEf3Q7CGWBVBd7SzAYZZRxEQgkFdOfBJNc+COB02qT8SdgTwidEYgskispbBn6/vV0kVH7KDVasiUAmqjd0ey8AzvKbdva7WJ4P6cUrNLAT7q/gsRlDVJFvJeFy7/mFUFFQCCfLSrJLlzRWwefyRkmbepykpnWnvmyQt14Z/r8CNr4C0FZT5cOjRbICt6fcKGqj8P+crraMQXNsTg0PUlHCdb7R6taUjtgXdkF4gi5j+G5TexY8t27MOIdpsvIDv5wxCTUH6899iABYtvg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d2zugJ0Ijrf2G/Ct3md7Xriuh67Ynt0qEGazpErXEYSTBEl0zMxEa6lRpJa+d3yx+4dRJIMiPyv3ct62icQ44JncBdh85/+2wfVNcS+ALrBf/9XpZlfuCPhqHTINcDLw+jYeLUoVHOG9gW/fo5SNbxgRKdkKJ13++oZrh41ovfp8kNIFidAnut8b67WxZxkYDomRP7UnASvUe1RGF+NXDxvkG21njrO4LhJ0WapMQ9FfglLgJ/ZadfBk3NIzqDc3EspAiFhLEp9jgO2XaGIaRSR8IiilzTNok5UB4534ZTkTGMaQm2iMrBFZWqR9k2z9IAp1nJLYlhyTnerUt4TrvA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Delivery-date: Mon, 13 Nov 2023 07:49:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11.11.2023 02:23, Stefano Stabellini wrote:
> On Mon, 6 Nov 2023, Nicola Vetrini wrote:
>>>>> There's also this functionally equivalent alternative, with or without
>>>>> the zeros, which
>>>>> doesn't incur in the risk of mistakenly attempting to initialize the
>>>>> same element twice,
>>>>> while also giving an explicit cue to the reader that all elements are
>>>>> truly zero-initialized.
>>>>>
>>>>>           .matches = {
>>>>>               DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
>>>>>               DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL5"),
>>>>> +            {0}, {0}
>>>>>           },
>>>>
>>>> Adding a dependency on the array actually having 4 elements (while iirc
>>>> we have seen already that we could in principle go down to 3). A change
>>>> of this number would then require touching all these sites, which is
>>>> what we'd like to avoid.
>>>
>>> How often the array needs to change though? Looking at the git history
>>> it doesn't seem the number of elements ever changed. So I think it is a
>>> good tradeoff, and I would go with this type of fix (maybe also at the
>>> other locations mechanically too although I haven't looked at them in
>>> details).
>>
>> Hi, any updates on this? Considering the opinions expressed above, what would
>> be the path preferred by the community?
> 
> Hi Jan, to bring this discussion to a conclusion, I think we have these
> options:
> 
> 1) fix these violations by adding {}, {}
> 2) fix these violations by adding [0]=xxx,[1]=xxx
> 3) deviate these violations by adding /* SAF-safe-xxx */
> 4) remove the MISRA rule 9.3 from docs/misra/rules.rst
> 
> Let's make a decision. My preference is 1) as we only have ~50
> violations.

Of these, to be honest, my preference would be 4. Just that that's
undesirable for other reasons. But have we thought of alternatives, say
a variadic macro that would supply the "missing" initializers? Imo such
decisions shouldn't be rushed; there are enough other issues to take
care of in the meantime. A sound solution is, I think, generally
preferable to a quick one. (Whether my new suggestion is "sound" I of
course can't tell, until it was tried out and the overall result /
effects can be inspected.)

Jan



 


Rackspace

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