Index: /trunk/include/VBox/HGSMI/HGSMIMemAlloc.h
===================================================================
--- /trunk/include/VBox/HGSMI/HGSMIMemAlloc.h	(revision 64649)
+++ /trunk/include/VBox/HGSMI/HGSMIMemAlloc.h	(revision 64650)
@@ -92,5 +92,7 @@
 {
     HGSMIOFFSET order = HGSMIPopCnt32(cb - 1) - HGSMI_MA_DESC_ORDER_BASE;
+#ifdef HGSMI_STRICT
     Assert(HGSMIMAOrder2Size(order) == cb);
+#endif
     return order;
 }
Index: /trunk/include/VBox/VBoxVideoGuest.h
===================================================================
--- /trunk/include/VBox/VBoxVideoGuest.h	(revision 64649)
+++ /trunk/include/VBox/VBoxVideoGuest.h	(revision 64650)
@@ -52,4 +52,20 @@
  typedef HGSMIHEAP HGSMIGUESTCMDHEAP;
 # define HGSMIGUESTCMDHEAP_GET(_p) (_p)
+#endif
+
+#if defined(IN_RING0) && defined(RT_OS_LINUX)
+# define VBVOAssert(a) do {} while(0)
+# define VBVOAssertPtr(a) do {} while(0)
+# define VBVOAssertReturnVoid(a) if (!(a)) return
+# define VBVOAssertRC(a) do {} while(0)
+# define VBVOAssertPtrNullReturnVoid(a) do {} while(0)
+# define VBVOAssertPtrReturnVoid(a) if (!(a)) return
+#else
+# define VBVOAssert Assert
+# define VBVOAssertPtr AssertPtr
+# define VBVOAssertReturnVoid AssertReturnVoid
+# define VBVOAssertRC AssertRC
+# define VBVOAssertPtrNullReturnVoid AssertPtrNullReturnVoid
+# define VBVOAssertPtrReturnVoid AssertPtrReturnVoid
 #endif
 
Index: /trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp	(revision 64649)
+++ /trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp	(revision 64650)
@@ -44,5 +44,5 @@
     HGSMIBUFFERHEADER *pHdr = HGSMIBufferHeaderFromData(pvMem);
     HGSMIOFFSET offMem = HGSMIPointerToOffset(&pCtx->areaCtx, pHdr);
-    Assert(offMem != HGSMIOFFSET_VOID);
+    VBVOAssert(offMem != HGSMIOFFSET_VOID);
     if(offMem != HGSMIOFFSET_VOID)
     {
@@ -57,5 +57,5 @@
 {
     int rc = HGSMIBufferProcess(&pCtx->areaCtx, &pCtx->channels, offBuffer);
-    Assert(!RT_FAILURE(rc));
+    VBVOAssert(!RT_FAILURE(rc));
     if(RT_FAILURE(rc))
     {
@@ -78,5 +78,5 @@
 {
     HGSMIOFFSET offset = hgsmiGetHostBuffer(pCtx);
-    AssertReturnVoid(offset != HGSMIOFFSET_VOID);
+    VBVOAssertReturnVoid(offset != HGSMIOFFSET_VOID);
     hgsmiHostCmdProcess(pCtx, offset);
 }
@@ -162,5 +162,5 @@
     HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (HGSMIGUESTCMDHEAP_GET(&pCtx->heapCtx), pvBuffer);
 
-    Assert(offBuffer != HGSMIOFFSET_VOID);
+    VBVOAssert(offBuffer != HGSMIOFFSET_VOID);
     if (offBuffer != HGSMIOFFSET_VOID)
     {
@@ -242,5 +242,5 @@
         if (RT_SUCCESS(rc))
         {
-            AssertRC(pCaps->rc);
+            VBVOAssertRC(pCaps->rc);
             rc = pCaps->rc;
         }
@@ -318,9 +318,9 @@
                                              uint32_t *poffHostFlags)
 {
-    AssertPtrNullReturnVoid(poffVRAMBaseMapping);
-    AssertPtrNullReturnVoid(pcbMapping);
-    AssertPtrNullReturnVoid(poffGuestHeapMemory);
-    AssertPtrNullReturnVoid(pcbGuestHeapMemory);
-    AssertPtrNullReturnVoid(poffHostFlags);
+    VBVOAssertPtrNullReturnVoid(poffVRAMBaseMapping);
+    VBVOAssertPtrNullReturnVoid(pcbMapping);
+    VBVOAssertPtrNullReturnVoid(poffGuestHeapMemory);
+    VBVOAssertPtrNullReturnVoid(pcbGuestHeapMemory);
+    VBVOAssertPtrNullReturnVoid(poffHostFlags);
     if (poffVRAMBaseMapping)
         *poffVRAMBaseMapping = cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE;
@@ -386,6 +386,6 @@
     uint32_t offVRAMHostArea = offVRAMBaseMapping, cbHostArea = 0;
 
-    AssertPtrReturnVoid(poffVRAMHostArea);
-    AssertPtrReturnVoid(pcbHostArea);
+    VBVOAssertPtrReturnVoid(poffVRAMHostArea);
+    VBVOAssertPtrReturnVoid(pcbHostArea);
     VBoxQueryConfHGSMI(pCtx, VBOX_VBVA_CONF32_HOST_HEAP_SIZE, &cbHostArea);
     if (cbHostArea != 0)
@@ -464,10 +464,10 @@
      * host heap is ready */
     int rc = vboxHGSMIReportFlagsLocation(pCtx, offVRAMFlagsLocation);
-    AssertRC(rc);
+    VBVOAssertRC(rc);
     if (RT_SUCCESS(rc) && fCaps)
     {
         /* Inform about caps */
         rc = vboxHGSMISendCapsInfo(pCtx, fCaps);
-        AssertRC(rc);
+        VBVOAssertRC(rc);
     }
     if (RT_SUCCESS (rc))
@@ -475,5 +475,5 @@
         /* Report the host heap location. */
         rc = vboxHGSMIReportHostArea(pCtx, offVRAMHostArea, cbHostArea);
-        AssertRC(rc);
+        VBVOAssertRC(rc);
     }
     // Log(("VBoxVideo::vboxSetupAdapterInfo finished rc = %d\n", rc));
Index: /trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp	(revision 64649)
+++ /trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp	(revision 64650)
@@ -23,10 +23,4 @@
 #ifndef VBOX_GUESTR3XF86MOD
 # include <iprt/string.h>
-#endif
-
-#ifndef LINUX_VERSION_CODE
-# define VBVOAssertPtr AssertPtr
-#else
-# define VBVOAssertPtr(a) do {} while(0)
 #endif
 
Index: /trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp	(revision 64649)
+++ /trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp	(revision 64650)
@@ -21,10 +21,4 @@
 #include <VBox/err.h>
 // #include <VBox/log.h>
-#ifndef LINUX_VERSION_CODE
-# include <iprt/assert.h>
-# define VBVOAssert Assert
-#else
-# define VBVOAssert(a) do {} while(0)
-#endif
 #include <iprt/string.h>
 
Index: /trunk/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp
===================================================================
--- /trunk/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp	(revision 64649)
+++ /trunk/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp	(revision 64650)
@@ -42,4 +42,13 @@
 #define HGSMI_STRICT_ASSERT(expr) do {} while (0)
 #endif /* !HGSMI_STRICT */
+
+/*
+ * We do not want assertions in Linux kernel code to reduce symbol dependencies.
+ */
+#if defined(IN_RING0) && defined(RT_OS_LINUX)
+# define HGSMI_ASSERT_PTR_RETURN(a, b) if (!(a)) return (b)
+#else
+# define HGSMI_ASSERT_PTR_RETURN(a, b) if (!(a)) return (b)
+#endif /* !IN_RING0 && RT_OS_LINUX */
 
 /* One-at-a-Time Hash from
@@ -189,6 +198,6 @@
                    const HGSMIENV *pEnv)
 {
-    AssertPtrReturn(pHeap, VERR_INVALID_PARAMETER);
-    AssertPtrReturn(pvBase, VERR_INVALID_PARAMETER);
+    HGSMI_ASSERT_PTR_RETURN(pHeap, VERR_INVALID_PARAMETER);
+    HGSMI_ASSERT_PTR_RETURN(pvBase, VERR_INVALID_PARAMETER);
 
     int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase);
@@ -368,6 +377,6 @@
     // LogFlowFunc(("pArea %p, offBuffer 0x%x\n", pArea, offBuffer));
 
-    AssertPtrReturn(pArea, VERR_INVALID_PARAMETER);
-    AssertPtrReturn(pChannelInfo, VERR_INVALID_PARAMETER);
+    HGSMI_ASSERT_PTR_RETURN(pArea, VERR_INVALID_PARAMETER);
+    HGSMI_ASSERT_PTR_RETURN(pChannelInfo, VERR_INVALID_PARAMETER);
 
     /* Guest has prepared a command description at 'offBuffer'. */
Index: /trunk/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp
===================================================================
--- /trunk/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp	(revision 64649)
+++ /trunk/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp	(revision 64650)
@@ -59,4 +59,16 @@
 #include <iprt/string.h>
 
+/*
+ * We do not want assertions in Linux kernel code to reduce symbol dependencies.
+ */
+#if defined(IN_RING0) && defined(RT_OS_LINUX)
+# define HGSMI_ASSERT_RETURN(a, b) if (!(a)) return (b)
+# define HGSMI_ASSERT_FAILED() do {} while (0)
+# define HGSMI_ASSERT(expr) do {} while (0)
+#else
+# define HGSMI_ASSERT_RETURN(a, b) AssertReturn(a, b)
+# define HGSMI_ASSERT_FAILED() AssertFailed()
+# define HGSMI_ASSERT(expr) Assert(expr)
+#endif /* !IN_RING0 && RT_OS_LINUX */
 
 DECLINLINE(HGSMIOFFSET) hgsmiMADescriptor(HGSMIOFFSET off, bool fFree, HGSMIOFFSET order)
@@ -222,5 +234,5 @@
     if (pBlock)
     {
-        AssertReturn(HGSMI_MA_DESC_IS_FREE(pBlock->descriptor), NULL);
+        HGSMI_ASSERT_RETURN(HGSMI_MA_DESC_IS_FREE(pBlock->descriptor), NULL);
 
         /* Where the block starts. */
@@ -298,5 +310,5 @@
                 {
                     /* Should never happen because the new set of blocks is supposed to be smaller. */
-                    AssertFailed();
+                    HGSMI_ASSERT_FAILED();
                     rc = VERR_OUT_OF_RESOURCES;
                     break;
@@ -325,5 +337,5 @@
     }
 
-    Assert(cbRemaining == 0);
+    HGSMI_ASSERT(cbRemaining == 0);
 
     if (RT_SUCCESS(rc))
@@ -354,5 +366,5 @@
                                   HGSMIMABLOCK **ppStart, HGSMIMABLOCK **ppEnd, HGSMISIZE *pcbBlocks)
 {
-    Assert(HGSMI_MA_DESC_IS_FREE(pBlock->descriptor));
+    HGSMI_ASSERT(HGSMI_MA_DESC_IS_FREE(pBlock->descriptor));
 
     *pcbBlocks = HGSMIMAOrder2Size(HGSMI_MA_DESC_ORDER(pBlock->descriptor));
@@ -418,5 +430,5 @@
         RTListForEach(&pMA->aListFreeBlocks[i], pIter, HGSMIMABLOCK, nodeFree)
         {
-            Assert(HGSMI_MA_DESC_ORDER(pIter->descriptor) == i);
+            HGSMI_ASSERT(HGSMI_MA_DESC_ORDER(pIter->descriptor) == i);
 
             HGSMISIZE cbBlocks;
@@ -425,5 +437,5 @@
             hgsmiMAQueryFreeRange(pMA, pIter, cbRequired, &pFreeStart, &pFreeEnd, &cbBlocks);
 
-            Assert((cbBlocks / HGSMI_MA_BLOCK_SIZE_MIN) * HGSMI_MA_BLOCK_SIZE_MIN == cbBlocks);
+            HGSMI_ASSERT((cbBlocks / HGSMI_MA_BLOCK_SIZE_MIN) * HGSMI_MA_BLOCK_SIZE_MIN == cbBlocks);
 
             /* Verify whether cbBlocks is enough for the requested block. */
@@ -460,6 +472,6 @@
     HGSMIOFFSET order = HGSMIPopCnt32(cb - 1) - HGSMI_MA_DESC_ORDER_BASE;
 
-    AssertReturn(HGSMIMAOrder2Size(order) >= cb, HGSMIOFFSET_VOID);
-    AssertReturn(order < RT_ELEMENTS(pMA->aListFreeBlocks), HGSMIOFFSET_VOID);
+    HGSMI_ASSERT_RETURN(HGSMIMAOrder2Size(order) >= cb, HGSMIOFFSET_VOID);
+    HGSMI_ASSERT_RETURN(order < RT_ELEMENTS(pMA->aListFreeBlocks), HGSMIOFFSET_VOID);
 
     HGSMIMABLOCK *pBlock = hgsmiMAGetFreeBlock(pMA, order);
@@ -489,5 +501,5 @@
 
     /* Find the block corresponding to the offset. */
-    Assert((off / HGSMI_MA_BLOCK_SIZE_MIN) * HGSMI_MA_BLOCK_SIZE_MIN == off);
+    HGSMI_ASSERT((off / HGSMI_MA_BLOCK_SIZE_MIN) * HGSMI_MA_BLOCK_SIZE_MIN == off);
 
     HGSMIMABLOCK *pBlock = HGSMIMASearchOffset(pMA, off);
@@ -503,5 +515,5 @@
     }
 
-    AssertFailed();
+    HGSMI_ASSERT_FAILED();
 }
 
@@ -510,6 +522,6 @@
                 const HGSMIENV *pEnv)
 {
-    AssertReturn(pArea->cbArea < UINT32_C(0x80000000), VERR_INVALID_PARAMETER);
-    AssertReturn(pArea->cbArea >= HGSMI_MA_BLOCK_SIZE_MIN, VERR_INVALID_PARAMETER);
+    HGSMI_ASSERT_RETURN(pArea->cbArea < UINT32_C(0x80000000), VERR_INVALID_PARAMETER);
+    HGSMI_ASSERT_RETURN(pArea->cbArea >= HGSMI_MA_BLOCK_SIZE_MIN, VERR_INVALID_PARAMETER);
 
     RT_ZERO(*pMA);
@@ -568,5 +580,5 @@
     }
 
-    AssertFailed();
+    HGSMI_ASSERT_FAILED();
     return HGSMIOFFSET_VOID;
 }
@@ -579,5 +591,5 @@
     }
 
-    AssertFailed();
+    HGSMI_ASSERT_FAILED();
     return NULL;
 }
@@ -598,5 +610,5 @@
     else
     {
-        AssertFailed();
+        HGSMI_ASSERT_FAILED();
     }
 }
