[ovs-dev] [PATCH 08/11] ovn-sbctl: Fix possible null pointer to qsort.

William Tu u9012063 at gmail.com
Sat Oct 28 17:31:55 UTC 2017

Clang reports possible null pointer 'lflows' passed to qsort.
This is due to the checker unable to make sure whether 'lflows'
gets malloc or not in the previous loop.  Thus, fix it by adding
ovs_assert to pass clang checker.

Signed-off-by: William Tu <u9012063 at gmail.com>
 ovn/utilities/ovn-sbctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
index 7af5863b08fc..b1f106002842 100644
--- a/ovn/utilities/ovn-sbctl.c
+++ b/ovn/utilities/ovn-sbctl.c
@@ -860,6 +860,7 @@ cmd_lflow_list(struct ctl_context *ctx)
         lflows[n_flows] = lflow;
+    ovs_assert(lflows);
     qsort(lflows, n_flows, sizeof *lflows, lflow_cmp);
     bool print_uuid = shash_find(&ctx->options, "--uuid") != NULL;

More information about the dev mailing list