Xen-Devel Archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Julien Grall" <julien@xen.org>,
	"Michal Orzel" <michal.orzel@amd.com>,
	roberto.bagnara@bugseng.com, consulting@bugseng.com,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH] docs/misra: add D4.12
Date: Wed, 15 May 2024 15:18:52 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2405151513530.2544314@ubuntu-linux-20-04-desktop> (raw)
In-Reply-To: <bd1072c5-1533-46b7-b6c8-fab1c0f80ab3@suse.com>

On Wed, 15 May 2024, Jan Beulich wrote:
> On 15.05.2024 01:15, Stefano Stabellini wrote:
> > Add D4.12 with the same explanation as the rules of the R21 series.
> > D4.12 refers to the standard library memory allocation functions and
> > similar third party libraries with memory allocation functions. It
> > doesn't refer to the in-tree implementation we have in Xen which is
> > subject to MISRA C rules and MISRA C scanning.
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> > 
> > diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> > index 80e5e972ad..bc8506add4 100644
> > --- a/docs/misra/rules.rst
> > +++ b/docs/misra/rules.rst
> > @@ -76,6 +76,11 @@ maintainers if you want to suggest a change.
> >         considered libraries from MISRA C point of view as they are
> >         imported in source form)
> >  
> > +   * - `Dir 4.12 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/D_04_12.c>`_
> > +     - Required
> > +     - Dynamic memory allocation shall not be used
> > +     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
> 
> I'm having trouble connecting this remark with the directive. We do have
> dynamic memory allocation routines, and we use them. It doesn't really
> matter that they don't come from an external library, does it?

Similarly to the 21.x rules series, it makes a difference if they are
external libraries or code within the project. The rule points out that
the standard library memory allocation functions can lead to undefined
behavior. On the other hand, our own implementation under xen.git is
subject to MISRA C scanning and all the other MISRA C rules.

The example in the link above, shows a use-after-free error that in our
case it should be caught by other MISRA C rules scanning.


  reply	other threads:[~2024-05-15 22:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 23:15 [PATCH] docs/misra: add D4.12 Stefano Stabellini
2024-05-15  7:35 ` Jan Beulich
2024-05-15 22:18   ` Stefano Stabellini [this message]
2024-05-27 18:22     ` Stefano Stabellini

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=alpine.DEB.2.22.394.2405151513530.2544314@ubuntu-linux-20-04-desktop \
    --to=sstabellini@kernel.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=consulting@bugseng.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roberto.bagnara@bugseng.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).