All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Luca Fancellu <Luca.Fancellu@arm.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>,
	Xen-devel <xen-devel@lists.xenproject.org>,
	michal.orzel@amd.com, xenia.ragiadakou@amd.com,
	"Ayan Kumar Halder" <ayan.kumar.halder@amd.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>,
	"Wei Liu" <wl@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>
Subject: Re: [XEN PATCH] xen: Add SAF deviations for MISRA C:2012 Rule 7.1
Date: Tue, 10 Oct 2023 11:04:26 +0200	[thread overview]
Message-ID: <784666fd145d1bdcd2afc4607de12dd1@bugseng.com> (raw)
In-Reply-To: <2AC05F6B-477A-45C3-A865-E0917692EE12@arm.com>

On 10/10/2023 09:29, Luca Fancellu wrote:
>> 
>>>> /* SAF-x-safe */
>>>> if ( modrm_mod == MASK_EXTR(instr_modrm, 0300) && (modrm_reg & 7) ==
>>>> MASK_EXTR(instr_modrm, 0070) && (modrm_rm & 7)  == 
>>>> MASK_EXTR(instr_modrm,
>>>> 0007) )
>>>> 
>>>> Any other ideas?
>>> 
>>> Could we have a number in the comment to indicate the number of lines 
>>> the
>>> comment applies to?
>> 
>> Luca can confirm that what I am about to write is correct; my
>> understanding is that ECLAIR supports it, but cppcheck does not. Which
>> means for cppcheck we would have to translate the SAF tag with
>> xen_analyize to:
>> 
>> /* cppcheck tag */
>> line1
>> /* cppcheck tag */
>> line2
>> /* cppcheck tag */
>> line3
>> 
>> and that would end up changing the line numbers in the source files so
>> the cppcheck report wouldn't match with the original line numbers any
>> longer
> 
> Yes, but it’s not only Cppcheck, it’s also Coverity that supports only
> the above notation.
> 
> For Cppcheck we could do something, but for Coverity we can’t.
> 
> Anyway, Stefano or Nicola, I would like to understand where Eclair
> reports the violation
> in the case of #define, does it report at the usage or at the 
> definition?
> 
> Cheers,
> Luca

The report is at the usage site, but ECLAIR can be configured to deviate 
based on a comment
at the macro definition, or also just the macro name for reports of that 
rule (e.g. Q[1-3]):

#define M(a, b) (b)
/* -E> safe MC3R1.R7.1 1 blabla */
#define Q1(s) M(s, 0300)
/* -E> safe MC3R1.R7.1 1 blabla */
#define Q2(s) M(s, 0070)
/* -E> safe MC3R1.R7.1 1 blabla */
#define Q3(s) M(s, 0007)

void f(void) {
   int x = 1;
   int y = 2;
   if ( (x & 2) == Q1(y) &&
        (x & 3) == Q2(y) &&
        (x & 7) == Q3(y) )
   {
      y = y + 1;
   }
}

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


  reply	other threads:[~2023-10-10  9:04 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
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 [this message]
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=784666fd145d1bdcd2afc4607de12dd1@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=Henry.Wang@arm.com \
    --cc=Luca.Fancellu@arm.com \
    --cc=andrew.cooper3@citrix.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=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.