From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: consulting@bugseng.com,
Stefano Stabellini <sstabellini@kernel.org>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
roger.pau@citrix.com, George Dunlap <george.dunlap@citrix.com>,
Wei Liu <wl@xen.org>
Subject: MISRA C:2012 D4.11 caution on staging
Date: Tue, 10 Oct 2023 11:31:01 +0200 [thread overview]
Message-ID: <7972c20f361126022fa97f6b51ca2d9c@bugseng.com> (raw)
Hi,
as you can see from [1], there's a MISRA C guideline, D4.11, that is
supposed to be clean
(i.e., have no reports), but has a caution on an argument to memcpy
(the second argument might be null according to the checker, given a set
of assumptions on
the control flow). To access the report just click on the second link in
the log, which should take you to a webpage with a list of
MISRA guidelines. Click on D4.11 and you'll see the full report, which I
pasted below for convenience.
If the finding is genuine, then some countermeasure needs to be taken
against this
possible bug, otherwise it needs to be motivated why the field
config->handle can't
be null at that point.
The finding is likely the result of an improvement made to the checker,
because the first
analysis I can see that spots it happened when rc1 has been tagged, but
that commit does not
touch the involved files.
[1] https://gitlab.com/xen-project/xen/-/jobs/5251222578
caution for MC3R1.D4.11 untagged
xen/common/domain.c:758.27-758.40:
[59] null pointer passed as 2nd argument to memory copy function
xen/common/domain.c:590.10-590.15:
[1] assuming 'config' is null
xen/common/domain.c:593.10-593.44:
[2] assuming the condition is false; taking false branch
<preprocessed xen/common/domain.c>:11332.10-11332.50:
preprocessed tokens
xen/include/xen/types.h:31.23:
expanded from macro `NULL'
xen/common/domain.c:603.12-603.27:
[3] '?' condition is true
<preprocessed xen/common/domain.c>:11336.37-11336.52:
preprocessed tokens
xen/include/xen/compiler.h:21.43:
expanded from macro `unlikely'
xen/include/xen/lib.h:26.15-26.28:
expanded from macro `ASSERT'
xen/include/xen/lib.h:26.26:
expanded from macro `ASSERT'
xen/common/domain.c:603.5-603.65:
[4] taking false branch
<preprocessed xen/common/domain.c>:11336.10-11336.11:
preprocessed tokens
xen/include/xen/lib.h:26.10-26.11:
expanded from macro `ASSERT'
xen/common/domain.c:603.5-603.65:
[5] loop condition is false: exiting loop
<preprocessed xen/common/domain.c>:11336.5-11336.6:
preprocessed tokens
xen/include/xen/lib.h:26.5-26.6:
expanded from macro `ASSERT'
xen/common/domain.c:605.10-605.15:
[6] 'config' is null
xen/common/domain.c:605.5-605.6:
[7] taking false branch
xen/common/domain.c:615.10-615.14:
[8] 'domid' is not equal to 0
xen/common/domain.c:615.24-615.28:
[9] 'domid' is not equal to hardware_domid
xen/common/domain.c:615.5-615.6:
[10] taking false branch
xen/common/domain.c:624.5-624.44:
[11] taking false branch
<preprocessed xen/common/domain.c>:11356.10-11356.11:
preprocessed tokens
xen/include/xen/trace.h:86.9-86.10:
expanded from macro `TRACE_varD'
xen/include/xen/trace.h:94.5-94.22:
expanded from macro `TRACE_1D'
xen/common/domain.c:624.5-624.44:
[12] loop condition is false: exiting loop
<preprocessed xen/common/domain.c>:11356.5-11356.6:
preprocessed tokens
xen/include/xen/trace.h:85.5-85.6:
expanded from macro `TRACE_varD'
xen/include/xen/trace.h:94.5-94.22:
expanded from macro `TRACE_1D'
xen/common/domain.c:630.5-630.39:
[13] assuming 'prof' is null; taking true branch
<preprocessed xen/common/domain.c>:11362.111-11362.115:
preprocessed tokens
xen/include/xen/spinlock.h:114.14-114.18:
expanded from macro `spin_lock_init_prof'
xen/common/domain.c:630.5-630.39:
[14] execution continues on line 631
<preprocessed xen/common/domain.c>:11363.104-11363.108:
preprocessed tokens
xen/include/xen/spinlock.h:119.13-119.17:
expanded from macro `spin_lock_init_prof'
xen/common/domain.c:631.5-631.43:
[15] assuming 'prof' is null; taking true branch
<preprocessed xen/common/domain.c>:11367.115-11367.119:
preprocessed tokens
xen/include/xen/spinlock.h:114.14-114.18:
expanded from macro `spin_lock_init_prof'
xen/common/domain.c:631.5-631.43:
[16] execution continues on line 632
<preprocessed xen/common/domain.c>:11368.112-11368.116:
preprocessed tokens
xen/include/xen/spinlock.h:119.13-119.17:
expanded from macro `spin_lock_init_prof'
xen/common/domain.c:642.24-642.36:
[17] '?' condition is true
<preprocessed xen/common/domain.c>:11377.92:
preprocessed tokens
xen/include/xen/bitmap.h:97.9:
expanded from macro `BITMAP_LAST_WORD_MASK'
xen/include/xen/nodemask.h:238.29-238.63:
expanded from macro `NODE_MASK_LAST_WORD'
xen/include/xen/nodemask.h:244.43-244.61:
expanded from macro `NODE_MASK_ALL'
xen/common/domain.c:662.5-662.6:
[18] taking false branch
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
next reply other threads:[~2023-10-10 9:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 9:31 Nicola Vetrini [this message]
2023-10-11 0:01 ` MISRA C:2012 D4.11 caution on staging Stefano Stabellini
2023-10-13 9:23 ` Julien Grall
2023-10-11 0:15 ` Andrew Cooper
2023-10-11 7:47 ` Nicola Vetrini
2023-10-11 7:51 ` Andrew Cooper
2023-10-13 9:27 ` Julien Grall
2023-10-13 15:11 ` Nicola Vetrini
2023-10-16 18:06 ` Julien Grall
2023-10-17 6:11 ` Jan Beulich
2023-10-17 13:28 ` Julien Grall
2023-10-18 12:30 ` Nicola Vetrini
2023-10-18 12:38 ` Julien Grall
2023-10-18 12:52 ` Nicola Vetrini
2023-10-18 13:02 ` Julien Grall
2023-10-18 21:33 ` Stefano Stabellini
2023-10-23 10:34 ` Nicola Vetrini
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=7972c20f361126022fa97f6b51ca2d9c@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=consulting@bugseng.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--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 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.