From 629bccc440a3c41273143edea6512cef6cd0eeb4 Mon Sep 17 00:00:00 2001 From: Tomasz Duszynski Date: Thu, 2 Nov 2017 09:37:25 +0100 Subject: [PATCH] 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: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton") Signed-off-by: Tomasz Duszynski --- drivers/net/mrvl/mrvl_qos.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mrvl/mrvl_qos.c b/drivers/net/mrvl/mrvl_qos.c index 54e682a36f..7c9943aac6 100644 --- a/drivers/net/mrvl/mrvl_qos.c +++ b/drivers/net/mrvl/mrvl_qos.c @@ -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; -- 2.20.1