teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0072-Never-call-qsort-on-potentially-NULL-arrays.patch

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