[PATCH v1 02/31] net/ntnic: add thread check return code

Stephen Hemminger stephen at networkplumber.org
Tue Jan 28 19:54:51 CET 2025


On Tue, 21 Jan 2025 18:07:40 +0100
Serhii Iliushyk <sil-plv at napatech.com> wrote:

> From: Danylo Vodopianov <dvo-plv at napatech.com>
> 
> CI found couple coverity problems which were fixed in this commit.
> 
> CID: 448965 Error handling issues (CHECKED_RETURN).
> 
> Thread return code check was added.
> 
> Coverity issue: 448965
> Fixes: a1ba8c473f5c ("net/ntnic: add statistics poll")
> 
> Signed-off-by: Danylo Vodopianov <dvo-plv at napatech.com>
> ---
>  drivers/net/ntnic/ntnic_ethdev.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c
> index 2a2643a106..620d023a71 100644
> --- a/drivers/net/ntnic/ntnic_ethdev.c
> +++ b/drivers/net/ntnic/ntnic_ethdev.c
> @@ -2516,8 +2516,11 @@ static int init_shutdown(void)
>  	NT_LOG(DBG, NTNIC, "Starting shutdown handler");
>  	kill_pmd = 0;
>  	previous_handler = signal(SIGINT, signal_handler_func_int);
> -	THREAD_CREATE(&shutdown_tid, shutdown_thread, NULL);
> -
> +	int ret = THREAD_CREATE(&shutdown_tid, shutdown_thread, NULL);
> +	if (ret != 0) {
> +		NT_LOG(ERR, NTNIC, "Failed to create shutdown thread, error code: %d", ret);
> +		return -1;
> +	}
>  	/*
>  	 * 1 time calculation of 1 sec stat update rtc cycles to prevent stat poll
>  	 * flooding by OVS from multiple virtual port threads - no need to be precise

This whole init thread and shutdown logic is broken.
There are vendor NFV applications that expect to be able to do.
  
         rte_eal_init()
         signal(SIGINT, my_shutdown_func)

This kind of problem was reported years ago with the TAP device, and it
had to change to use a different signal.



More information about the dev mailing list