eventdev: check input parameter for dump op
authorDavid Marchand <david.marchand@redhat.com>
Sun, 1 Nov 2020 20:36:44 +0000 (21:36 +0100)
committerJerin Jacob <jerinj@marvell.com>
Mon, 2 Nov 2020 13:46:51 +0000 (14:46 +0100)
Rather than have drivers check for this, let's ensure the passed FILE *
is not NULL.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
lib/librte_eventdev/rte_eventdev.c

index 994bd1e..afbadc5 100644 (file)
@@ -1153,6 +1153,8 @@ rte_event_dev_dump(uint8_t dev_id, FILE *f)
        RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
        dev = &rte_eventdevs[dev_id];
        RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
+       if (f == NULL)
+               return -EINVAL;
 
        (*dev->dev_ops->dump)(dev, f);
        return 0;