From: Juergen Gross Date: Wed, 13 Dec 2023 09:49:06 +0000 (+0100) Subject: Mini-OS: use BUG() instead of dereferencing NULL X-Git-Tag: xen-4.19.0-rc4~8 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=23247d6586110ec3d73cae8a693c0db879a58184;p=mini-os.git Mini-OS: use BUG() instead of dereferencing NULL There are some places using a dereference of NULL to cause a crash. Use BUG() instead. Reported-by: Jan Beulich Signed-off-by: Juergen Gross Acked-by: Andrew Cooper --- diff --git a/lib/xmalloc.c b/lib/xmalloc.c index cc5db11..2aa0713 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -219,7 +219,7 @@ void xfree(const void *p) if(((long)p & PAGE_MASK) != ((long)hdr & PAGE_MASK)) { printk("Header should be on the same page\n"); - *(int*)0=0; + BUG(); } /* Merge with other free block, or put in list. */ @@ -255,7 +255,7 @@ void xfree(const void *p) if((((unsigned long)hdr) & (PAGE_SIZE-1)) != 0) { printk("Bug\n"); - *(int*)0=0; + BUG(); } free_page(hdr); }