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

[RFC] Next steps for MISRA C Rule 17.7 in XEN


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Sat, 2 Aug 2025 17:48:11 +0000
  • Accept-language: en-US, uk-UA, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Ej0Bymq+pXP4vV+9sbVFLLMVo4Hx7NOfVgawxm5lS0g=; b=BaAv/+/XGofOOuv6SeLWAhwYJKhxwv3foW2AgPCEkWv+aZmKoJ2Zs3MWEbfIvySUINF5Jn2lf+Knv3Q/claItE22udux03KAT6M8Dc5btviaRh20f7njDLekecjxRqb127MDINpr56k0/z4y5225PqvxnixOotYbftRHoYJwP1z9SVEdiNC6yDlHaK9QQSPVfQ0UjV9956rWKqFthSRtFwWjX6kDJbHhfXsn/hKdZ1bOxQ6MttVrLXGemOv6UNX1EC/Rn5z2aJyLLziAxltYzPqR/Fjd+AnG/p0L1M2yzdcyqG18f4XzZGG7U3VOS0ycHOfFnbVqClD9yebwcdny0w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Baf5S2iZh5NGSiXqyfb0uw3VT0wW0yB6Nl/UJByL/gNYW6vNxgahcVuo5AmK/JrjySLjc97uSigt5zJ5j2rDII+K7nUIPAH3arudarovD9KVMwCyBfeyj/iUbGQh8Iw2XhjkYwWVmMNUKNJ150olALmykUO0tNKJ18Rh8DS0nn3XL2dL/blDwH75p+EpqYlDlCw5e4cvUm3l5uEdnXQm4Bggvy0gZmAjnDGVd3GltLXn4/mxjQRiTb1GiG29l3XF/T1EE2hc8fP4VRfxQdYGh/Ko3L4AkRwT0g9DDmaJbzyJ4dfny4EsbxID+fxHNTMbyCvKR8ADdRR4sH4/UHqy2Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Delivery-date: Sat, 02 Aug 2025 17:48:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcA9WdQBGGn1ngVkiEBTFhozxERA==
  • Thread-topic: [RFC] Next steps for MISRA C Rule 17.7 in XEN

Hello folks!

There are a lot of MISRA C R17.7 violations in the XEN.
This rule states: "The value returned by a function having non-void 
return type shall be used".

Actually, need to decide how to deal with these violations.
Quick analyze shown that there are different cases in XEN code base.
Like, for example:

the return value of function `clean_and_invalidate_dcache_va_range(const 
void*, unsigned long)' (unit `xen/arch/arm/alternative.c' with target 
`xen/arch/arm/alternative.o') is unexpectedly ignored

The return value of this function 'clean_and_invalidate_dcache_va_range' 
is checked only in one place. Probably, after deeper analyze the return 
value can be dropped and function prototype can be changed to

static inline void clean_and_invalidate_dcache_va_range
     (const void *p, unsigned long size);


Next case is vice versa:

the return value of function `vgic_reserve_virq(struct domain*, 
unsigned)' is unexpectedly ignored

There is only one place where the return value is not checked.
Probably, in this place code may be changed to:

     (void)vgic_reserve_virq(d, irq);


For the case with 'memset' function:

the return value of function `memset(void*, int, size_t)' is 
unexpectedly ignored

I guess it's better to create deviation, something like:

"The return value of the function memset(void *, int, size_t) is ignored 
because the primary purpose of the function is to set a block of memory 
to a specific value, not to use the pointer returned by the function."


But due to the large number of violations, it will be tricky to address 
all of them.
I don't know, maybe the only right solution is to deviate all.


Thanks!
Dmytro.

 


Rackspace

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