]> xenbits.xensource.com Git - mini-os.git/commitdiff
Mini-OS: use BUG() instead of dereferencing NULL
authorJuergen Gross <jgross@suse.com>
Wed, 13 Dec 2023 09:49:06 +0000 (10:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 13 Dec 2023 09:49:06 +0000 (10:49 +0100)
There are some places using a dereference of NULL to cause a crash.

Use BUG() instead.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
lib/xmalloc.c

index cc5db11e0e0035c4b1f39ecc93f06672f9f6a1e4..2aa0713859aec245d6b4e9f39d87d6fe54e85378 100644 (file)
@@ -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);
     }