net/bnxt: fix a pointer deref before null check
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Tue, 24 Oct 2017 21:19:47 +0000 (16:19 -0500)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 26 Oct 2017 00:33:01 +0000 (02:33 +0200)
Coverity issue: 195015
Fixes: b7435d660a8c ("net/bnxt: add ntuple filtering support")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c

index 9065a12..c2d54ef 100644 (file)
@@ -2039,6 +2039,11 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
                        goto free_filter;
                STAILQ_INSERT_TAIL(&vnic->filter, bfilter, next);
        } else {
+               if (mfilter == NULL) {
+                       /* This should not happen. But for Coverity! */
+                       ret = -ENOENT;
+                       goto free_filter;
+               }
                ret = bnxt_hwrm_clear_ntuple_filter(bp, mfilter);
 
                STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info,