]> xenbits.xensource.com Git - freebsd.git/commitdiff
vnic: avoid NULL deref in error case
authoremaste <emaste@FreeBSD.org>
Thu, 29 Aug 2019 12:05:06 +0000 (12:05 +0000)
committeremaste <emaste@FreeBSD.org>
Thu, 29 Aug 2019 12:05:06 +0000 (12:05 +0000)
Reported by: Dr Silvio Cesare of InfoSect
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

sys/dev/vnic/thunder_bgx.c

index ef0ca546ce9c219ccfe83f39499a9ff79ab6a0ba..6d34b320ef51d92b01cc9f2c3131d3855b8e73e1 100644 (file)
@@ -502,9 +502,8 @@ bgx_add_dmac_addr(uint64_t dmac, int node, int bgx_idx, int lmac)
        bgx_idx += node * MAX_BGX_PER_CN88XX;
        bgx = bgx_vnic[bgx_idx];
 
-       if (!bgx) {
-               device_printf(bgx->dev,
-                   "BGX%d not yet initialized, ignoring DMAC addition\n",
+       if (bgx == NULL) {
+               printf("BGX%d not yet initialized, ignoring DMAC addition\n",
                    bgx_idx);
                return;
        }