All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Luca Fancellu <Luca.Fancellu@arm.com>,
	Nicola Vetrini <nicola.vetrini@bugseng.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	Xen-devel <xen-devel@lists.xenproject.org>,
	"michal.orzel@amd.com" <michal.orzel@amd.com>,
	"xenia.ragiadakou@amd.com" <xenia.ragiadakou@amd.com>,
	"Ayan Kumar Halder" <ayan.kumar.halder@amd.com>,
	"consulting@bugseng.com" <consulting@bugseng.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Henry Wang" <Henry.Wang@arm.com>,
	"Simone Ballarin" <simone.ballarin@bugseng.com>,
	"Doug Goldstein" <cardoe@cardoe.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Julien Grall" <julien@xen.org>, "Wei Liu" <wl@xen.org>
Subject: Re: [XEN PATCH] xen: Add SAF deviations for MISRA C:2012 Rule 7.1
Date: Wed, 4 Oct 2023 12:17:40 +0100	[thread overview]
Message-ID: <23802fca-7aaf-4792-a57c-2a3b2502ca70@citrix.com> (raw)
In-Reply-To: <B00BC78B-E707-4043-A0B4-D320C6717472@arm.com>

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

On 04/10/2023 11:52 am, Luca Fancellu wrote:
> From the documentation:
>
>     In the Xen codebase, these tags will be used to document and suppress findings:
>
>     - SAF-X-safe: This tag means that the next line of code contains a finding, but
>       the non compliance to the checker is analysed and demonstrated to be safe.
>
> I understand that Eclair is capable of suppressing also the line in which the in-code suppression
> comment resides, but these generic Xen in-code suppression comment are meant to be used
> by multiple static analysis tools and many of them suppress only the line next to the comment
> (Coverity, cppcheck).
>
> So I’m in favour of your approach below, clearly it depends on what the maintainers feedback is:
>
>>                          /* SAF-2-safe */
>>   if ( modrm_mod      == MASK_EXTR(instr_modrm, 0300) &&
>>                          /* SAF-2-safe */
>>       (modrm_reg & 7) == MASK_EXTR(instr_modrm, 0070) &&
>>                          /* SAF-2-safe */
>>       (modrm_rm & 7)  == MASK_EXTR(instr_modrm, 0007) )

To be clear, this is illegible and a non-starter from a code maintenance
point of view.

It is bad enough needing annotations to start with, but the annotations
*must* not interfere with the prior legibility.

The form with comments on the end, that do not break up the tabulation
of the code, is tolerable, providing the SAF turns into something
meaningful.

~Andrew

P.S. to be clear, I'm not saying that an ahead-of-line comments are
unacceptable generally.  Something like

    /* $FOO-$N-safe */
    if ( blah )

might be fine in context, but that is a decision that needs to be made
based on how the code reads with the comment in place.

[-- Attachment #2: Type: text/html, Size: 2328 bytes --]

  reply	other threads:[~2023-10-04 11:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 15:37 [XEN PATCH] xen: Add SAF deviations for MISRA C:2012 Rule 7.1 Nicola Vetrini
2023-10-03 16:17 ` andrew.cooper3
2023-10-03 17:14   ` Luca Fancellu
2023-10-03 17:27     ` Andrew Cooper
2023-10-03 18:21       ` Stefano Stabellini
2023-10-03 20:46 ` Stefano Stabellini
2023-10-04  9:56   ` andrew.cooper3
2023-10-04 10:06     ` Luca Fancellu
2023-10-04 10:29       ` Nicola Vetrini
2023-10-04 10:52         ` Luca Fancellu
2023-10-04 11:17           ` Andrew Cooper [this message]
2023-10-04 11:36             ` Luca Fancellu
2023-10-04 12:23           ` Nicola Vetrini
2023-10-04 23:32           ` Stefano Stabellini
2023-10-05  7:35             ` Luca Fancellu
2023-10-06  1:02               ` Stefano Stabellini
2023-10-06  7:58                 ` Luca Fancellu
2023-10-07  0:43                   ` Stefano Stabellini
2023-10-09  8:09                     ` Luca Fancellu
2023-10-09  8:51                     ` Julien Grall
2023-10-09 22:19                       ` Stefano Stabellini
2023-10-10  7:29                         ` Luca Fancellu
2023-10-10  9:04                           ` Nicola Vetrini
2023-10-10 10:46                         ` Julien Grall
2023-10-10 23:39                           ` Stefano Stabellini
2023-10-11  9:45                             ` Julien Grall
2023-10-11  9:51                               ` Julien Grall
2023-10-11 10:53                                 ` Luca Fancellu
2023-10-11 12:01                                   ` Julien Grall
2023-10-12 23:17                                     ` Stefano Stabellini
2023-10-16  9:40             ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23802fca-7aaf-4792-a57c-2a3b2502ca70@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Henry.Wang@arm.com \
    --cc=Luca.Fancellu@arm.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=cardoe@cardoe.com \
    --cc=consulting@bugseng.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=nicola.vetrini@bugseng.com \
    --cc=roger.pau@citrix.com \
    --cc=simone.ballarin@bugseng.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xenia.ragiadakou@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.