Index: trunk/include/VBox/vmm/pdmnetinline.h
===================================================================
--- trunk/include/VBox/vmm/pdmnetinline.h	(revision 97825)
+++ trunk/include/VBox/vmm/pdmnetinline.h	(revision 97869)
@@ -88,20 +88,16 @@
 DECLINLINE(bool) PDMNetGsoIsValid(PCPDMNETWORKGSO pGso, size_t cbGsoMax, size_t cbFrame)
 {
+#define CHECK_COND_RETURN_FALSE(expr) if (RT_LIKELY(expr)) { /* likely */ } else return false
     PDMNETWORKGSOTYPE enmType;
 
-    if (RT_LIKELY(cbGsoMax >= sizeof(*pGso)))
-    { /* likely */ } else return false;
+    CHECK_COND_RETURN_FALSE(cbGsoMax >= sizeof(*pGso));
 
     enmType = (PDMNETWORKGSOTYPE)pGso->u8Type;
-    if (RT_LIKELY( enmType > PDMNETWORKGSOTYPE_INVALID && enmType < PDMNETWORKGSOTYPE_END ))
-    { /* likely */ } else return false;
+    CHECK_COND_RETURN_FALSE(enmType > PDMNETWORKGSOTYPE_INVALID && enmType < PDMNETWORKGSOTYPE_END);
 
     /* all types requires both headers. */
-    if (RT_LIKELY( pGso->offHdr1 >= sizeof(RTNETETHERHDR) ))
-    { /* likely */ } else return false;
-    if (RT_LIKELY( pGso->offHdr2 > pGso->offHdr1 ))
-    { /* likely */ } else return false;
-    if (RT_LIKELY( pGso->cbHdrsTotal > pGso->offHdr2 ))
-    { /* likely */ } else return false;
+    CHECK_COND_RETURN_FALSE(pGso->offHdr1 >= sizeof(RTNETETHERHDR));
+    CHECK_COND_RETURN_FALSE(pGso->offHdr2 > pGso->offHdr1);
+    CHECK_COND_RETURN_FALSE(pGso->cbHdrsTotal > pGso->offHdr2);
 
     /* min size of the 1st header(s). */
@@ -110,21 +106,19 @@
         case PDMNETWORKGSOTYPE_IPV4_TCP:
         case PDMNETWORKGSOTYPE_IPV4_UDP:
-            if (RT_LIKELY( (unsigned)pGso->offHdr2 - pGso->offHdr1 >= RTNETIPV4_MIN_LEN ))
-            { /* likely */ } else return false;
+            CHECK_COND_RETURN_FALSE((unsigned)pGso->offHdr2 - pGso->offHdr1 >= RTNETIPV4_MIN_LEN);
             break;
         case PDMNETWORKGSOTYPE_IPV6_TCP:
         case PDMNETWORKGSOTYPE_IPV6_UDP:
-            if (RT_LIKELY( (unsigned)pGso->offHdr2 - pGso->offHdr1 >= RTNETIPV6_MIN_LEN ))
-            { /* likely */ } else return false;
+            CHECK_COND_RETURN_FALSE((unsigned)pGso->offHdr2 - pGso->offHdr1 >= RTNETIPV6_MIN_LEN);
             break;
         case PDMNETWORKGSOTYPE_IPV4_IPV6_TCP:
         case PDMNETWORKGSOTYPE_IPV4_IPV6_UDP:
-            if (RT_LIKELY( (unsigned)pGso->offHdr2 - pGso->offHdr1 >= RTNETIPV4_MIN_LEN + RTNETIPV6_MIN_LEN ))
-            { /* likely */ } else return false;
-            break;
+            CHECK_COND_RETURN_FALSE((unsigned)pGso->offHdr2 - pGso->offHdr1 >= RTNETIPV4_MIN_LEN + RTNETIPV6_MIN_LEN);
+            break;
+        /* These two have been rejected above already, but we need to include them to avoid gcc warnings. */
         case PDMNETWORKGSOTYPE_INVALID:
         case PDMNETWORKGSOTYPE_END:
             break;
-        /* no default case! want gcc warnings. */
+        /* No default case! Want gcc warnings. */
     }
 
@@ -135,34 +129,30 @@
         case PDMNETWORKGSOTYPE_IPV6_TCP:
         case PDMNETWORKGSOTYPE_IPV4_IPV6_TCP:
-            if (RT_LIKELY( (unsigned)pGso->cbHdrsTotal - pGso->offHdr2 >= RTNETTCP_MIN_LEN ))
-            { /* likely */ } else return false;
+            CHECK_COND_RETURN_FALSE((unsigned)pGso->cbHdrsTotal - pGso->offHdr2 >= RTNETTCP_MIN_LEN);
             break;
         case PDMNETWORKGSOTYPE_IPV4_UDP:
         case PDMNETWORKGSOTYPE_IPV6_UDP:
         case PDMNETWORKGSOTYPE_IPV4_IPV6_UDP:
-            if (RT_LIKELY( (unsigned)pGso->cbHdrsTotal - pGso->offHdr2 >= RTNETUDP_MIN_LEN ))
-            { /* likely */ } else return false;
-            break;
+            CHECK_COND_RETURN_FALSE((unsigned)pGso->cbHdrsTotal - pGso->offHdr2 >= RTNETUDP_MIN_LEN);
+            break;
+        /* These two have been rejected above already, but we need to include them to avoid gcc warnings. */
         case PDMNETWORKGSOTYPE_INVALID:
         case PDMNETWORKGSOTYPE_END:
             break;
-        /* no default case! want gcc warnings. */
+        /* No default case! Want gcc warnings. */
     }
 
     /* There must be at more than one segment. */
-    if (RT_LIKELY( cbFrame > pGso->cbHdrsTotal ))
-    { /* likely */ } else return false;
-    if (RT_LIKELY( cbFrame - pGso->cbHdrsTotal >= pGso->cbMaxSeg ))
-    { /* likely */ } else return false;
+    CHECK_COND_RETURN_FALSE(cbFrame > pGso->cbHdrsTotal);
+    CHECK_COND_RETURN_FALSE(cbFrame - pGso->cbHdrsTotal >= pGso->cbMaxSeg);
 
     /* Make sure the segment size is enough to fit a UDP header. */
-    if (RT_LIKELY(enmType != PDMNETWORKGSOTYPE_IPV4_UDP || pGso->cbMaxSeg >= RTNETUDP_MIN_LEN))
-    { /* likely */ } else return false;
+    CHECK_COND_RETURN_FALSE(enmType != PDMNETWORKGSOTYPE_IPV4_UDP || pGso->cbMaxSeg >= RTNETUDP_MIN_LEN);
 
     /* Make sure the segment size is not zero. */
-    if (RT_LIKELY(pGso->cbMaxSeg > 0))
-    { /* likely */ } else return false;
+    CHECK_COND_RETURN_FALSE(pGso->cbMaxSeg > 0);
 
     return true;
+#undef CHECK_COND_RETURN_FALSE
 }
 
