Skip to content

Commit d891a59

Browse files
shemmingerdavid-marchand
authored andcommitted
raw/ifpga: fix free function mismatch in interrupt config
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: d61138d ("drivers: remove direct access to interrupt handle") Cc: [email protected] Signed-off-by: Stephen Hemminger <[email protected]> Acked-by: Morten Brørup <[email protected]> Acked-by: Konstantin Ananyev <[email protected]> Acked-by: Wathsala Vithanage <[email protected]>
1 parent 1198622 commit d891a59

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/raw/ifpga/ifpga_rawdev.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ ifpga_register_msix_irq(struct ifpga_rawdev *dev, int port_id,
14991499

15001500
nb_intr = rte_intr_nb_intr_get(*intr_handle);
15011501

1502-
intr_efds = calloc(nb_intr, sizeof(int));
1502+
intr_efds = rte_calloc("ifpga_efds", nb_intr, sizeof(int), 0);
15031503
if (!intr_efds)
15041504
return -ENOMEM;
15051505

@@ -1508,7 +1508,7 @@ ifpga_register_msix_irq(struct ifpga_rawdev *dev, int port_id,
15081508

15091509
ret = opae_acc_set_irq(acc, vec_start, count, intr_efds);
15101510
if (ret) {
1511-
free(intr_efds);
1511+
rte_free(intr_efds);
15121512
return -EINVAL;
15131513
}
15141514
}
@@ -1517,13 +1517,13 @@ ifpga_register_msix_irq(struct ifpga_rawdev *dev, int port_id,
15171517
ret = rte_intr_callback_register(*intr_handle,
15181518
handler, (void *)arg);
15191519
if (ret) {
1520-
free(intr_efds);
1520+
rte_free(intr_efds);
15211521
return -EINVAL;
15221522
}
15231523

15241524
IFPGA_RAWDEV_PMD_INFO("success register %s interrupt", name);
15251525

1526-
free(intr_efds);
1526+
rte_free(intr_efds);
15271527
return 0;
15281528
}
15291529

0 commit comments

Comments
 (0)