net/mrvl: reset errno before library call

In case errno contains some non-zero value and call to strtoul() is
successful -2 error will be returned.

Setting errno to zero before calling strtoul() makes sure
errors will be handled correctly.

Fixes: 0ddc9b815b ("net/mrvl: add net PMD skeleton")

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
This commit is contained in:
Tomasz Duszynski 2017-11-02 09:37:25 +01:00 committed by Ferruh Yigit
parent cafba10bc1
commit 629bccc440

View File

@ -99,6 +99,7 @@ get_val_securely(const char *string, uint32_t *val)
if (len == 0)
return -1;
errno = 0;
*val = strtoul(string, &endptr, 0);
if (errno != 0 || RTE_PTR_DIFF(endptr, string) != len)
return -2;