diff mbox

[ovs-dev,3/6] dpctl: Skip invoking qsort on empty list

Message ID 1497898444-116702-3-git-send-email-bhanuprakash.bodireddy@intel.com
State Accepted
Headers show

Commit Message

Bodireddy, Bhanuprakash June 19, 2017, 6:54 p.m. UTC
Clang reports "Argument with 'nonnull' attribute passed null" warning.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
---
 lib/dpctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ben Pfaff June 20, 2017, 2:35 a.m. UTC | #1
On Mon, Jun 19, 2017 at 07:54:01PM +0100, Bhanuprakash Bodireddy wrote:
> Clang reports "Argument with 'nonnull' attribute passed null" warning.
> 
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>

Thanks!  Applied to master and branch-2.7.
diff mbox

Patch

diff --git a/lib/dpctl.c b/lib/dpctl.c
index 7f44d02..2ad475b 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -555,7 +555,9 @@  show_dpif(struct dpif *dpif, struct dpctl_params *dpctl_p)
         n_port_nos++;
     }
 
-    qsort(port_nos, n_port_nos, sizeof *port_nos, compare_port_nos);
+    if (port_nos) {
+        qsort(port_nos, n_port_nos, sizeof *port_nos, compare_port_nos);
+    }
 
     for (int i = 0; i < n_port_nos; i++) {
         if (dpif_port_query_by_number(dpif, port_nos[i], &dpif_port)) {