All of lore.kernel.org
 help / color / mirror / Atom feed
* [XEN PATCH][for-4.19] domain: add ASSERT to help static analysis tools
@ 2023-11-03 17:58 Nicola Vetrini
  2023-11-03 18:08 ` Nicola Vetrini
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Nicola Vetrini @ 2023-11-03 17:58 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, michal.orzel, xenia.ragiadakou, ayan.kumar.halder,
	consulting, jbeulich, andrew.cooper3, roger.pau, Nicola Vetrini,
	George Dunlap, Julien Grall, Wei Liu

Static analysis tools may detect a possible null
pointer dereference at line 760 (the memcpy call)
of xen/common/domain.c. This ASSERT helps them in
detecting that such a condition is not possible
and also provides a basic sanity check.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
The check may be later improved by proper error checking
instead of relying on the semantics explained here:
https://lore.kernel.org/xen-devel/61f04d4b-34d9-4fd1-a989-56b042b4f3d8@citrix.com/

This addresses the caution reported by ECLAIR for MISRA C:2012 D4.11
---
 xen/common/domain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 8f9ab01c0cb7..9378c0417645 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -700,6 +700,8 @@ struct domain *domain_create(domid_t domid,
 
     if ( !is_idle_domain(d) )
     {
+        ASSERT(config);
+
         watchdog_domain_init(d);
         init_status |= INIT_watchdog;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-11-14 16:05 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-03 17:58 [XEN PATCH][for-4.19] domain: add ASSERT to help static analysis tools Nicola Vetrini
2023-11-03 18:08 ` Nicola Vetrini
2023-11-07  4:18   ` Stefano Stabellini
2023-11-08  8:24 ` Jan Beulich
2023-11-08 11:03   ` Nicola Vetrini
2023-11-08 11:19     ` Jan Beulich
2023-11-08 13:28       ` Nicola Vetrini
2023-11-09  7:44         ` Jan Beulich
2023-11-08 13:33       ` Julien Grall
2023-11-09  7:42         ` Jan Beulich
2023-11-09  9:10           ` Julien Grall
2023-11-10  0:29             ` Stefano Stabellini
2023-11-10  9:06               ` Julien Grall
2023-11-10 16:30                 ` Nicola Vetrini
2023-11-11  1:13                   ` Stefano Stabellini
2023-11-14 16:05                     ` Nicola Vetrini
2023-11-08 13:37 ` Andrew Cooper
2023-11-08 13:45   ` Nicola Vetrini
2023-11-10 16:56     ` Andrew Cooper

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.