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. Fix it by checking the
'n_flows' before calling qsort.
Signed-off-by: William Tu
---
ovn/utilities/ovn-sbctl.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
index c5ec4e6eaf24..6f3743b55632 100644
--- a/ovn/utilities/ovn-sbctl.c
+++ b/ovn/utilities/ovn-sbctl.c
@@ -860,7 +860,10 @@ cmd_lflow_list(struct ctl_context *ctx)
lflows[n_flows] = lflow;
n_flows++;
}
-qsort(lflows, n_flows, sizeof *lflows, lflow_cmp);
+
+if (n_flows) {
+qsort(lflows, n_flows, sizeof *lflows, lflow_cmp);
+}
bool print_uuid = shash_find(&ctx->options, "--uuid") != NULL;
--
2.7.4
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev