Add a new BUG macro in utils which can be used in places
where you don't expect control to reach.

Whenever this happens, the code will intentionally crash
via a null pointer de reference.

Signed-off-by: Nikhil Devshatwar <nikhil...@ti.com>
---
 hypervisor/include/jailhouse/utils.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hypervisor/include/jailhouse/utils.h 
b/hypervisor/include/jailhouse/utils.h
index 411f6365..39615945 100644
--- a/hypervisor/include/jailhouse/utils.h
+++ b/hypervisor/include/jailhouse/utils.h
@@ -21,6 +21,8 @@
 #define ARRAY_SIZE(array)      (sizeof(array) / sizeof((array)[0]))
 #endif
 
+#define BUG()                  *(int *)0 = 0xdead
+
 /* sizeof() for a structure/union field */
 #define FIELD_SIZEOF(type, fld)        (sizeof(((type *)0)->fld))
 
-- 
2.17.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20201030122909.12737-1-nikhil.nd%40ti.com.

Reply via email to