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

Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>, Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Mon, 6 Feb 2023 15:37:22 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=GwsG7IefSP2GkK6J1PpfDL/s9Svfm7wg2M+oTHlM9UA=; b=fLfB7Y5b+lCBUCMi8KGAAvVSu3Mn4fboxrBzV9RzoAkmBtUxj1R8EhSnFn+qYnCPJIcUfw2w/G+xlFMfosojQ5fh4brr4YL4W1wEN1+BqLY3FzcFIgPunfeV3lCf4MwpxSjeY3X6HCWuUy8MZ9TKC9Rr+rjQgsAtJx0TNrZd70028yjCz5VM4NgVgc6kwiKgLLffl3rE7WZ+g//bE1LTJ7YQ0keOvTvabbc4ePl9BNn70xT5qDY28l8cqkL/mGZ98L4Ht4na+BedaFubiQ6HO1oGDNUuo6Xqy3qyhLZM5tBXz3ZPXT8LixF40XeDLGQOoGNNPy0AudFok0BeNMe4Iw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eK3YgWcDRz03FuuMMbCY5rtuj6ibMgcqFWIW2lULHNjRf7g2yhOaqbIqk0N7ylEgcHeWDouA+oilUbMr4xLr9ldubEVrRj4ygMwX47Xy7bWdln86eih9fhg2isNEZ/+bjyPYbCfgVkgBHwjToQiUM4HZFk73R6jLL12/J/0rzwR+R/1ODFDS6SdTTcjlW//DPCqMKc40WKowYyeVuRYDptlu9RZYdQenAXbTL2e2qMIY/3RB+HrGPLl1/14KPuFxLGqa1fvf+dMHt6ZB+WmIWCIR2bEFZCwfAgdw2hz3h2W1TTZrsBgfj0n7kTzlyAzWh4ywHIeNiyQJanHs7esPYQ==
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Mon, 06 Feb 2023 14:37:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Luca,

On 06/02/2023 15:31, Luca Fancellu wrote:
> 
> 
> Hi Xenia,
> 
>> On 3 Feb 2023, at 19:09, Xenia Ragiadakou <burzalodowa@xxxxxxxxx> wrote:
>>
>> Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
>> ---
>>
>> Changes in v3:
>>  - the fixes are based solely to Eclair findings (the tool has been
>>    adjusted to report only those violations that can result to a bug)
>>  - reflect this in the commit title
>>
>> xen/include/xen/device_tree.h | 14 +++++++-------
>> 1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
>> index a28937d12ae8..7839a199e311 100644
>> --- a/xen/include/xen/device_tree.h
>> +++ b/xen/include/xen/device_tree.h
>> @@ -37,11 +37,11 @@ struct dt_device_match {
>>     const void *data;
>> };
>>
>> -#define __DT_MATCH_PATH(p)              .path = p
>> -#define __DT_MATCH_TYPE(typ)            .type = typ
>> -#define __DT_MATCH_COMPATIBLE(compat)   .compatible = compat
>> +#define __DT_MATCH_PATH(p)              .path = (p)
>> +#define __DT_MATCH_TYPE(typ)            .type = (typ)
>> +#define __DT_MATCH_COMPATIBLE(compat)   .compatible = (compat)
>> #define __DT_MATCH_NOT_AVAILABLE()      .not_available = 1
>> -#define __DT_MATCH_PROP(p)              .prop = p
>> +#define __DT_MATCH_PROP(p)              .prop = (p)
>>
>> #define DT_MATCH_PATH(p)                { __DT_MATCH_PATH(p) }
>> #define DT_MATCH_TYPE(typ)              { __DT_MATCH_TYPE(typ) }
>> @@ -226,13 +226,13 @@ dt_find_interrupt_controller(const struct 
>> dt_device_match *matches);
>> #define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1
>>
>> #define dt_for_each_property_node(dn, pp)                   \
>> -    for ( pp = dn->properties; pp != NULL; pp = pp->next )
>> +    for ( pp = (dn)->properties; (pp) != NULL; pp = (pp)->next )
>>
>> #define dt_for_each_device_node(dt, dn)                     \
>> -    for ( dn = dt; dn != NULL; dn = dn->allnext )
>> +    for ( dn = dt; (dn) != NULL; dn = (dn)->allnext )
>>
>> #define dt_for_each_child_node(dt, dn)                      \
>> -    for ( dn = dt->child; dn != NULL; dn = dn->sibling )
>> +    for ( dn = (dt)->child; (dn) != NULL; dn = (dn)->sibling )
>>
>> /* Helper to read a big number; size is in cells (not bytes) */
>> static inline u64 dt_read_number(const __be32 *cell, int size)
>> --
>> 2.37.2
>>
>>
> 
> While the changes looks sensible to me, I’ve had a look in eclair but I was 
> unable to find the findings,
> here what findings I have in the latest report:
> https://eclairit.com:8443/job/XEN/Target=ARM64,agent=docker1/lastBuild/eclair/packageName.832204620/fileName.1811675806/

Eclair does not report violations at the definition but rather at the use.
Check domain_build.c for example to see the reports for 20.7 related to these 
macros.

~Michal



 


Rackspace

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