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:
parent
cafba10bc1
commit
629bccc440
@ -99,6 +99,7 @@ get_val_securely(const char *string, uint32_t *val)
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
*val = strtoul(string, &endptr, 0);
|
*val = strtoul(string, &endptr, 0);
|
||||||
if (errno != 0 || RTE_PTR_DIFF(endptr, string) != len)
|
if (errno != 0 || RTE_PTR_DIFF(endptr, string) != len)
|
||||||
return -2;
|
return -2;
|
||||||
|
Loading…
Reference in New Issue
Block a user