On Wed, 3 Apr 2019 17:07:26 +0100
Mohammad Abdul Awal <[email protected]> wrote:
> Null value for parameter name will cause segfault for the
> strnlen and strcmp functions.
>
> Fixes: 0b33b68d12 ("ethdev: export allocate function")
> Fixes: 942661004c ("ethdev: export secondary attach function")
> Cc: [email protected]
>
> Signed-off-by: Mohammad Abdul Awal <[email protected]>
> ---
> lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 10bdfb37e..26898ed08 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -440,6 +440,11 @@ rte_eth_dev_allocate(const char *name)
> struct rte_eth_dev *eth_dev = NULL;
> size_t name_len;
>
> + if (name == NULL) {
> + RTE_ETHDEV_LOG(ERR, "Null pointer is specified\n");
> + return NULL;
> + }
> +
Ok, but I doubt that a driver that is so buggy that it passes NULL
that it will do any proper error handling on return of NULL.
Would rather just see the application crash hard immediately.