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

Re: [PATCH] Add more rules to docs/misra/rules.rst


  • To: Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 26 Jan 2023 17:44:29 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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=oemARvIFtOwswuNzV3njIwrpUKIuh/DvcovG4shLT0U=; b=X0i1Q+9N1clSLPg5SQ/sYeNrUn1z3+HBraOvE+U/tazc/9heJp+0Vw/nxGJLXDfIIcFBAI/YXILxFBfn3KrtFJKnumsFH+8HvvbJ8SLq77OSjrTP9b3E3hiH4UfGKsezGYzQZYtkFToH5eutQTij83buzhaSr/qcW150Newrv40NrQLQYIMz91UA+3Ku9fbGAH1FGCQRuz6//AOHU8UrZ2orE6sk8Co3yhe8aIXag+ovjc9Bc/6ZnOgcn9h/gq6wjO039dk26NfylDj8RWmwDbtbdLWhpJZ++Eu5gT9nwiIBSpa2vYicEb/iPSHR4gVjt8AUvK+YPiuHn/B43aROSw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ojmv1VtyFUFgcDx2SEtOnLgMu/igI+C5JlLBttAPqmJKAx+SkhbS1JgL16P+r7iI3/4i1pvheghcIwFWEFWIMfB2VP6DafAdz7lbs742r/PycqmRwJs/iLNIifsM/SvDmcNVRIt2PHA5gMFZIeND9wu8a2nIPW5TMs3bu3Gtxbr+JZzgjllNZhh0Rc8A19KcLftyH0/EJxtghWrbAdDLW+ObMmVyJ6r3rBofatG//a4wt45lQkquo5evn0ZYGQLR90rJpRs0HuT9uRDoyr7OVOBMhc2GJwuGl6O7+l2wW7s9oUs/WCsE3F+Yb/uy8DD0loZz/AggKD2S/zUXYnmkzw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, george.dunlap@xxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Bertrand.Marquis@xxxxxxx, julien@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 26 Jan 2023 16:45:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.01.2023 16:59, Stefano Stabellini wrote:
> On Thu, 26 Jan 2023, Jan Beulich wrote:
>> On 25.01.2023 21:57, Stefano Stabellini wrote:
>>> From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
>>>
>>> As agreed during the last MISRA C discussion, I am adding the following
>>> MISRA C rules: 7.1, 7.3, 18.3.
>>>
>>> I am also adding 13.1 and 18.2 that were "agreed pending an analysis on
>>> the amount of violations".
>>>
>>> In the case of 13.1 there are zero violations reported by cppcheck.
>>>
>>> In the case of 18.2, there are zero violations reported by cppcheck
>>> after deviating the linker symbols, as discussed.
>>
>> I find this suspicious.
> 
> Hi Jan, you are right to be suspicious about 18.2 :-)  cppcheck is
> clearly not doing a great job at finding violations. Here is the full
> picture:
> 
> - cppcheck finds 3 violations, obviously related to linker symbols
> specifically common/version.c:xen_build_init and
> xen/lib/ctors.c:init_constructors
> 
> - Coverity finds 9 violations, not sure which ones
> 
> - Eclair finds 56 total on x86. Eclair is always the strictest of the
>   three tools and is flagging:
>   - the usage of the guest_mode macro in x86/traps.c and other places
>   - the usage of the NEED_OP/NEED_IP macros in common/lzo.c
>   the remaining violations should be less than 10
> 
> 
>> See e.g. ((pg) - frame_table) expressions both Arm
>> and x86 have. frame_table is neither a linker generated symbol, nor does
>> it represent something that the compiler (or static analysis tools) would
>> recognized as an "object". Still, the entire frame table of course
>> effectively is an object (array), yet there's no way for any tool to
>> actually recognize the array dimension.
> 
> I used cppcheck in my original email because it is the only tool today
> where I can add a deviation as an in-code comment, re-run the scan,
> and what happens (see the number of violations go down.)
> 
> However also considering that Coverity reports less than 10, and Eclair
> reports more but due to only 2-3 macros, I think 18.2 should be
> manageable.

That's not the conclusion I would draw. If none of the three finds what
ought to be found, I'm not convinced this can be considered "manageable".
Subsequent tool improvements may change the picture quite unexpectedly.

Jan



 


Rackspace

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