net/bnxt: fix interrupt vector initialization
authorNaresh Kumar PBS <nareshkumar.pbs@broadcom.com>
Sat, 8 Jun 2019 19:22:07 +0000 (23:22 +0400)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 13 Jun 2019 15:01:06 +0000 (00:01 +0900)
Initialize the vector array when it is valid, thereby
preventing a case were it may be accessed when
the array is unallocated

Fixes: 1fe427fd08ee ("net/bnxt: support enable/disable interrupt")
Cc: stable@dpdk.org
Signed-off-by: Naresh Kumar PBS <nareshkumar.pbs@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c

index ee88e9a..12fb0a7 100644 (file)
@@ -412,13 +412,12 @@ static int bnxt_init_chip(struct bnxt *bp)
                        "intr_handle->nb_efd = %d intr_handle->max_intr = %d\n",
                         intr_handle->intr_vec, intr_handle->nb_efd,
                        intr_handle->max_intr);
-       }
-
-       for (queue_id = 0; queue_id < bp->eth_dev->data->nb_rx_queues;
-            queue_id++) {
-               intr_handle->intr_vec[queue_id] = vec;
-               if (vec < base + intr_handle->nb_efd - 1)
-                       vec++;
+               for (queue_id = 0; queue_id < bp->eth_dev->data->nb_rx_queues;
+                    queue_id++) {
+                       intr_handle->intr_vec[queue_id] = vec;
+                       if (vec < base + intr_handle->nb_efd - 1)
+                               vec++;
+               }
        }
 
        /* enable uio/vfio intr/eventfd mapping */