* [dpdk-dev] [PATCH] net/mrvl: reset errno before library call
@ 2017-11-02 8:37 Tomasz Duszynski
2017-11-02 18:57 ` Ferruh Yigit
0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Duszynski @ 2017-11-02 8:37 UTC (permalink / raw)
To: dev; +Cc: Tomasz Duszynski
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 <tdu@semihalf.com>
---
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 55f6406..2076228 100644
--- a/drivers/net/mrvl/mrvl_qos.c
+++ b/drivers/net/mrvl/mrvl_qos.c
@@ -122,6 +122,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.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-02 18:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02 8:37 [dpdk-dev] [PATCH] net/mrvl: reset errno before library call Tomasz Duszynski
2017-11-02 18:57 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).