The function strerror() is insecure in a multi-thread environment.
This patch uses strerror_r() to replace it.
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
---
lib/eventdev/rte_event_eth_rx_adapter.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
@@ -1082,6 +1082,7 @@ rxa_intr_ring_enqueue(struct event_eth_rx_adapter *rx_adapter, void *data)
union queue_data qd;
struct eth_device_info *dev_info;
struct eth_rx_queue_info *queue_info;
+ char errmsg[RTE_STRERR_BUFSIZE];
int *intr_enabled;
qd.ptr = data;
@@ -1104,9 +1105,12 @@ rxa_intr_ring_enqueue(struct event_eth_rx_adapter *rx_adapter, void *data)
* vectors supported (an interrupt vector is shared in
* case of shared interrupts)
*/
- if (err)
+ if (err) {
+ if (strerror_r(-err, errmsg, sizeof(errmsg)) != 0)
+ snprintf(errmsg, sizeof(errmsg), "Unknown error %d", -err);
RTE_EDEV_LOG_ERR("Failed to enqueue interrupt"
- " to ring: %s", strerror(-err));
+ " to ring: %s", errmsg);
+ }
else
rte_eth_dev_rx_intr_disable(port_id, queue);
}