We currently have no check on the mempool pointer passed to
rte_eth_rx_queue_setup.
Let's avoid a plain crash when dereferencing it.
Suggested-by: Jens Freimann <jfreimann@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
return -EINVAL;
}
+ if (mp == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Invalid null mempool pointer\n");
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
* @return
* - 0: Success, receive queue correctly set up.
* - -EIO: if device is removed.
- * - -EINVAL: The size of network buffers which can be allocated from the
- * memory pool does not fit the various buffer sizes allowed by the
- * device controller.
+ * - -EINVAL: The memory pool pointer is null or the size of network buffers
+ * which can be allocated from this memory pool does not fit the various
+ * buffer sizes allowed by the device controller.
* - -ENOMEM: Unable to allocate the receive ring descriptors or to
* allocate network memory buffers from the memory pool when
* initializing receive descriptors.