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

Re: [XEN PATCH][for-4.19 v5] xen: Add deviations for MISRA C:2012 Rule 7.1


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Tue, 31 Oct 2023 15:12:49 +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=armh.onmicrosoft.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=1T7yeauCTR7omGi+XgRXjd0oVPLCF1kXscxWhae86wg=; b=SLPZkVVfvu/h0uzg74mNUOTYvJ4fxS5IXo/uEXIqpw7F1bsFZBdWoMeQUOBo4eFYw5RbGKm6C8Ymb+YWxI65j92T0fBTG15D/aweLgdZc1mZOUYDZcmIu5xfr4kS75vzW8yjABpRU6YYZAGpb3CK/JPEJZ2thQ6qxUkxTDqgjiupljdIjKmtccfuDCUTX4lCAGb6qIYZ47orwCNCiO82DE98JpPHO7Px2+t8PvkSrsuLTuVl+XSk/utcF9FAD8w3Q+wAL7iycKP7x5pvKnSjpSNmN+UutAR/Khe5HV7QhLriYgPDzbLg29ia9pXMazIPh0STrpQfGEzZ1FAysThXbg==
  • 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=1T7yeauCTR7omGi+XgRXjd0oVPLCF1kXscxWhae86wg=; b=T2/yZio/UG+LDCI78Lpky/skOAkZ5TGlOjt3LUz+J9eqnrfX3vPs+NWjUehnpSCcg0it2azjgqp4cVw1KdUMcHf4x3LzAG3wZM/XY5QkFKB1QNk2M00V0kSmrOeDHhNWNab3L0/7HjEmBdrz0A2LJYHIB0q5jgcJOI4z6bHCJlLt609RQNIbaOpz7kvdeUQMAU4AZUDEVaFkoBBcFLTrP9Fv6AaMcqU0rE206w4XG1OJOxgcEzDRjIt2tTPhBpgfzJbAqKnt9FHmEqjnXPryYUBatuc6T7F6io7b69RZmQgwFukNoC+11/Sx4THpNwH0tc7JrPXSqZBzECaDTdnz1g==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=iBz+jZNLh+EkchED5TRmd40FBrTxCXKQTfAO33T82RuQZVGX/viTHkkviFCQpDqvExp/tA7KPsxjg0EqcbW1qj4q7Qt2XimFw8+s/1CNu5R/f5VgEurCrbZRm7+o2jsolnUjPXM0K72hkqAyZCp4oucEbwrOOs9ydntLsCKrBITPEmZJGGdO1LaGLdPLP8n0MXEzs9Q/EItyUAOiyEdWhPUo7EpI9KwpQFTZ/kkI9wDJmxNDoJnuWWBK/taYs9tmdIWgnHnJkTeUdUFjDt8poxPjreVqqCaaYbj/7V1eTgcA2ciDa1fGHaGuyn/q/u/VM3peFHLVvW8OqrI/FyxxXQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SRLDCkXy3wgQ3W1JAW5yONX9sO3JW/Qzs+hQb8VmbyAjYM28HCuKrtBIJyf7u3ZHhkkSKL4u2mkBm4DNe2s284bQZ13IW4mdIXIFE+8nH0QEtbIZuh8E+DjZwfjIXm9e+WrQK20vksF+SGUWbAlI9JaWfTtuwVGcEWAaJvQVP5czFd5jHRz+5X0XYHsgLZL4QVLIn9850DOJqhfR0tkk3vlk13cB7IkeHkMAqEMn7CkrmXM3Fz79zEbALeXLp7V2XFP9lVzmb2BmwYR75hOgxnRClTpNeeG2z2+N32ORuQGz7alpDbwlFXfcuAvDj0673lxVyxrP6GFR8bKrK6B3VA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "michal.orzel@xxxxxxx" <michal.orzel@xxxxxxx>, "xenia.ragiadakou@xxxxxxx" <xenia.ragiadakou@xxxxxxx>, "ayan.kumar.halder@xxxxxxx" <ayan.kumar.halder@xxxxxxx>, "consulting@xxxxxxxxxxx" <consulting@xxxxxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, Simone Ballarin <simone.ballarin@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 31 Oct 2023 15:14:22 +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: AQHaC/4b2xNoaiIkmUiyfHAuabY8yrBj8OgAgAAP5gCAAACVgA==
  • Thread-topic: [XEN PATCH][for-4.19 v5] xen: Add deviations for MISRA C:2012 Rule 7.1


> On 31 Oct 2023, at 15:10, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> wrote:
> 
> On 2023-10-31 15:13, Luca Fancellu wrote:
>>> On 31 Oct 2023, at 13:27, Julien Grall <julien@xxxxxxx> wrote:
>>> Hi Stefano,
>>> On 30/10/2023 22:49, Stefano Stabellini wrote:
>>>> On Mon, 30 Oct 2023, Julien Grall wrote:
>>>>> Hi Nicola,
>>>>> On 27/10/2023 16:11, Nicola Vetrini wrote:
>>>>>> diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
>>>>>> index 8511a189253b..8aaaa1473fb4 100644
>>>>>> --- a/docs/misra/deviations.rst
>>>>>> +++ b/docs/misra/deviations.rst
>>>>>> @@ -90,6 +90,13 @@ Deviations related to MISRA C:2012 Rules:
>>>>>>           - __emulate_2op and __emulate_2op_nobyte
>>>>>>           - read_debugreg and write_debugreg
>>>>>>  +   * - R7.1
>>>>>> +     - It is safe to use certain octal constants the way they are 
>>>>>> defined
>>>>>> +       in specifications, manuals, and algorithm descriptions. Such 
>>>>>> places
>>>>>> +       are marked safe with a /\* octal-ok \*/ in-code comment, or with 
>>>>>> a
>>>>>> SAF
>>>>>> +       comment (see safe.json).
>>>>> Reading this, it is unclear to me why we have two ways to deviate the rule
>>>>> r7.1. And more importantely, how would the developper decide which one to 
>>>>> use?
>>>> I agree with you on this and we were discussing this topic just this
>>>> morning in the FUSA community call. I think we need a way to do this
>>>> with the SAF framework:
>>>> if (some code with violation) /* SAF-xx-safe */
>>>> This doesn't work today unfortunately. It can only be done this way:
>>>> /* SAF-xx-safe */
>>>> if (some code with violation)
>>>> Which is not always desirable. octal-ok is just an ad-hoc solution for
>>>> one specific violation but we need a generic way to do this. Luca is
>>>> investigating possible ways to support the previous format in SAF.
>>> Why can't we use octal-ok everywhere for now? My point here is to make 
>>> simple for the developper to know what to use.
>>>> I think we should take this patch for now and harmonize it once SAF is
>>>> improved.
>>> The description of the deviation needs some improvement. To give an 
>>> example, with the current wording, one could they can use octal-ok 
>>> everywhere. But above, you are implying that SAF-xx-safe should be
>>> preferred.
>>> I would still strongly prefer if we use octal-ok everywhere because this is 
>>> simple to remember. But if the other are happy to have both SAF-XX and 
>>> octal-ok, then the description needs to be completely unambiguous and the 
>>> patch should contain some explanation why we have two different ways to 
>>> deviate.
>> Would it be ok to have both, for example: /* SAF-XX-safe octal-ok */
>> So that the suppression engine do what it should (currently it doesn’t 
>> suppress the same line, but we could do something about it) and the developer
>> has a way to understand what is the violation here without going to the 
>> justification database.
> 
> I guess. It could overflow the 80-char limit in xen/arch/x86/hvm/svm/svm.h, 
> though.

Yeah, but we could rule out something in code_style to allow only this kind of 
trailing comments to exceed the 80 chars

> 
> -- 
> Nicola Vetrini, BSc
> Software Engineer, BUGSENG srl (https://bugseng.com)


 


Rackspace

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