diff mbox

[ovs-dev,2/6] dpif-netdev: Skip invoking qsort on empty list.

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

Commit Message

Bodireddy, Bhanuprakash June 19, 2017, 6:54 p.m. UTC
sorted_poll_list() returns the sorted list of rxqs mapped to PMD thread
along with the rxq count. Skip sorting the list if there are no rxqs
mapped to the PMD thread. This can be reproduced with manual pinning and
'dpif-netdev/pmd-rxq-show' command.

Also Clang reports that null argument is passed to qsort in this case.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
---
 lib/dpif-netdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ben Pfaff June 20, 2017, 2:35 a.m. UTC | #1
On Mon, Jun 19, 2017 at 07:54:00PM +0100, Bhanuprakash Bodireddy wrote:
> sorted_poll_list() returns the sorted list of rxqs mapped to PMD thread
> along with the rxq count. Skip sorting the list if there are no rxqs
> mapped to the PMD thread. This can be reproduced with manual pinning and
> 'dpif-netdev/pmd-rxq-show' command.
> 
> Also Clang reports that null argument is passed to qsort in this case.
> 
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>

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

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 2b65dc7..4b5b23b 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -884,10 +884,9 @@  sorted_poll_list(struct dp_netdev_pmd_thread *pmd, struct rxq_poll **list,
             i++;
         }
         ovs_assert(i == *n);
+        qsort(ret, *n, sizeof *ret, compare_poll_list);
     }
 
-    qsort(ret, *n, sizeof *ret, compare_poll_list);
-
     *list = ret;
 }