The raw ifpga driver redefines malloc to be opae_malloc
and free to be opae_free; which is a bad idea.

This leads to case where interrupt efd array is allocated
with calloc() and then passed to rte_free. The workaround
is to allocate the array with rte_calloc() instead.

Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
Cc: hka...@marvell.com
Cc: sta...@dpdk.org

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 drivers/raw/ifpga/ifpga_rawdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index a972b3b7a4..86558c7b9b 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1499,7 +1499,7 @@ ifpga_register_msix_irq(struct ifpga_rawdev *dev, int 
port_id,
 
                nb_intr = rte_intr_nb_intr_get(*intr_handle);
 
-               intr_efds = calloc(nb_intr, sizeof(int));
+               intr_efds = rte_calloc("ifpga_efds", nb_intr, sizeof(int), 0);
                if (!intr_efds)
                        return -ENOMEM;
 
@@ -1508,7 +1508,7 @@ ifpga_register_msix_irq(struct ifpga_rawdev *dev, int 
port_id,
 
                ret = opae_acc_set_irq(acc, vec_start, count, intr_efds);
                if (ret) {
-                       free(intr_efds);
+                       rte_free(intr_efds);
                        return -EINVAL;
                }
        }
@@ -1517,13 +1517,13 @@ ifpga_register_msix_irq(struct ifpga_rawdev *dev, int 
port_id,
        ret = rte_intr_callback_register(*intr_handle,
                        handler, (void *)arg);
        if (ret) {
-               free(intr_efds);
+               rte_free(intr_efds);
                return -EINVAL;
        }
 
        IFPGA_RAWDEV_PMD_INFO("success register %s interrupt\n", name);
 
-       free(intr_efds);
+       rte_free(intr_efds);
        return 0;
 }
 
-- 
2.45.2

Reply via email to