VPP-1032: fix coverity warnings

Change-Id: Ic3a0c51e5408921051deaf2e50372d9654574b27
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/src/vnet/dns/dns.c b/src/vnet/dns/dns.c
index 71ae7bb..9facb9b 100644
--- a/src/vnet/dns/dns.c
+++ b/src/vnet/dns/dns.c
@@ -690,6 +690,15 @@
   if (dm->is_enabled == 0)
     return VNET_API_ERROR_NAME_RESOLUTION_NOT_ENABLED;
 
+  /*
+   * Silence spurious coverity warning. We know pool_elts >> 0, or
+   * we wouldn't be here...
+   */
+#ifdef __COVERITY__
+  if (pool_elts (dm->entries) == 0)
+    return VNET_API_ERROR_UNSPECIFIED;
+#endif
+
   dns_cache_lock (dm);
   limit = pool_elts (dm->entries);
   start_index = random_u32 (&dm->random_seed) % limit;
@@ -936,8 +945,7 @@
 	  pos += len;
 	  len = *pos++;
 	}
-      qp = (dns_query_t *) pos;
-      pos += sizeof (*qp);
+      pos += sizeof (dns_query_t);
     }
   pos2 = pos;
   /* expect a pointer chase here for a CNAME record */
@@ -1122,7 +1130,7 @@
 	      if ((pos[0] & 0xC0) == 0xC0)
 		{
 		  curpos = pos + 2;
-		  break;
+		  goto curpos_set;
 		}
 	      pos += len;
 	      len = *pos++;
@@ -1130,6 +1138,7 @@
 	  curpos = pos;
 	}
 
+    curpos_set:
       rr = (dns_rr_t *) curpos;
 
       switch (clib_net_to_host_u16 (rr->type))