[dpdk-dev] [PATCH] eal: clear errno before calling strtoull() to parse base_virtaddr

Burakov, Anatoly anatoly.burakov at intel.com
Thu Jun 19 17:46:21 CEST 2014


Hi Aaron,

It seems that Pablo De Lara has beat you to it by a few minutes :-) Are there any other places this could potentially happen?

> Must reset errno to zero before calling strtoull(), else on success it could be
> any arbitrary value from past errors.
> 
> Signed-off-by: Aaron Campbell <aaron at arbor.net>
> ---
>  lib/librte_eal/linuxapp/eal/eal.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index 6994303..d204387 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -562,6 +562,7 @@ eal_parse_base_virtaddr(const char *arg)
>  	char *end;
>  	uint64_t addr;
> 
> +	errno = 0;
>  	addr = strtoull(arg, &end, 16);
> 
>  	/* check for errors */
> --
> 1.8.3.2



More information about the dev mailing list