From f70247febe1e61bb77f9ba318a7dea55491d0b84 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sat, 8 Sep 2018 19:47:05 +0200 Subject: [PATCH] lib: fix SA warning in skiplist code Clang was thinking the random level could be negative. (And, no, I couldn't figure that out by reading its output... trial and error this was.) Signed-off-by: David Lamparter --- lib/skiplist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/skiplist.c b/lib/skiplist.c index a36bf47139..585cf859e5 100644 --- a/lib/skiplist.c +++ b/lib/skiplist.c @@ -202,6 +202,7 @@ int skiplist_insert(register struct skiplist *l, register void *key, } k = randomLevel(); + assert(k >= 0); if (k > l->level) { k = ++l->level; update[k] = l->header; -- 2.39.5