ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
65878a
From 87f830a2046141ed917661a726c3ec38b4d15e89 Mon Sep 17 00:00:00 2001
65878a
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
65878a
Date: Fri, 11 Oct 2013 19:33:13 -0400
65878a
Subject: [PATCH] Never call qsort on potentially NULL arrays
65878a
65878a
This extends 62678ded 'efi: never call qsort on potentially
65878a
NULL arrays' to all other places where qsort is used and it
65878a
is not obvious that the count is non-zero.
65878a
---
65878a
 src/shared/cgroup-show.c | 2 ++
65878a
 1 file changed, 2 insertions(+)
65878a
65878a
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
65878a
index aa0f017..f6e56db 100644
65878a
--- a/src/shared/cgroup-show.c
65878a
+++ b/src/shared/cgroup-show.c
65878a
@@ -44,6 +44,8 @@ static void show_pid_array(int pids[], unsigned n_pids, const char *prefix, unsi
65878a
         unsigned i, m, pid_width;
65878a
         pid_t biggest = 0;
65878a
 
65878a
+        assert(n_pids > 0);
65878a
+
65878a
         /* Filter duplicates */
65878a
         m = 0;
65878a
         for (i = 0; i < n_pids; i++) {