[ovs-dev] [PATCH] ovs-thread: Break recursion for coverage counters.
Saurabh Shah
ssaurabh at vmware.com
Thu Dec 12 02:45:05 UTC 2013
Looks good to me. Thanks for fixing this!
From: Gurucharan Shetty <shettyg at nicira.com<mailto:shettyg at nicira.com>>
Date: Wednesday, December 11, 2013 4:11 PM
To: "dev at openvswitch.org<mailto:dev at openvswitch.org>" <dev at openvswitch.org<mailto:dev at openvswitch.org>>
Subject: [ovs-dev] [PATCH] ovs-thread: Break recursion for coverage counters.
For systems that do not use linker sections and also do not
have either HAVE_THREAD_LOCAL or HAVE___THREAD (ex: windows
using MSVC), a COVERAGE_INC() calls xmalloc which inturn calls
COVERAGE_INC() creating a recursion that causes a stack overflow.
This commit breaks the recursion by calling malloc() instead of
xmalloc()
Signed-off-by: Gurucharan Shetty <gshetty at nicira.com<mailto:gshetty at nicira.com>>
---
lib/ovs-thread.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/ovs-thread.h b/lib/ovs-thread.h
index 7f3195d..8de0f27 100644
--- a/lib/ovs-thread.h
+++ b/lib/ovs-thread.h
@@ -313,7 +313,10 @@ void xpthread_join(pthread_t, void **);
if (!value) { \
static const NAME##_type initial_value = __VA_ARGS__; \
\
- value = xmalloc(sizeof *value); \
+ value = malloc(sizeof *value); \
+ if (value == NULL) { \
+ out_of_memory(); \
+ } \
*value = initial_value; \
xpthread_setspecific(NAME##_key, value); \
} \
--
1.7.9.5
_______________________________________________
dev mailing list
dev at openvswitch.org<mailto:dev at openvswitch.org>
https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=pEkjsHfytvHEWufeZPpgqSOJMdMjuZPbesVsNhCUc0E%3D%0A&m=HChkh6ne5OJCVvYw0WP5wywcMq64u64%2FmhcsvoD8Rqc%3D%0A&s=be73dc6736c4f0d1a84ec8b61ec9fa1f4b5aba836968fb445c923f1a42c7b92e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20131211/89a6e266/attachment-0003.html>
More information about the dev
mailing list