[ovs-dev] [PATCH 1/4] util: Disallow zero-sized xmalloc_cacheline

YAMAMOTO Takashi yamamoto at valinux.co.jp
Sat May 3 00:01:01 UTC 2014


xmalloc_cacheline API is relatively new.  It's better
not to inherit the kludge from xmalloc.  This kind of
kludge rather hurts these days.

Signed-off-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>
---
 lib/util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/util.c b/lib/util.c
index 1ebe22a..464d730 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -203,6 +203,7 @@ xmalloc_cacheline(size_t size)
      *     - Space following the payload up to the end of the cache line, so
      *       that the end of the payload doesn't potentially share a cache line
      *       with some following block. */
+    ovs_assert(size != 0);
     base = xmalloc((CACHE_LINE_SIZE - 1)
                    + ROUND_UP(MEM_ALIGN + size, CACHE_LINE_SIZE));
 
-- 
1.8.3.1




More information about the dev mailing list