Clean-up: assert that get_count_order() returns a positive value
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 12 Sep 2019 14:02:06 +0000 (10:02 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 12 Sep 2019 14:02:06 +0000 (10:02 -0400)
The callers of get_count_order() don't handle negative values
correctly. However, those should not happen without a previous
bug. Assert that its return value is >= 0.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/ust-metadata.c

index 0eccac654883a6f4c0a1ea92604518b0aed13210..08199a16a080d438408b627d05f7b04778e2e36b 100644 (file)
@@ -85,8 +85,10 @@ int get_count_order(unsigned int count)
        int order;
 
        order = fls(count) - 1;
-       if (count & (count - 1))
+       if (count & (count - 1)) {
                order++;
+       }
+       assert(order >= 0);
        return order;
 }
 
This page took 0.02584 seconds and 4 git commands to generate.