dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0125-lscpu-improve-for-offline-CPUs-on-AMD.patch

531551
From 4150eb1025c059f9459f98ef6c6c3fac730eaf93 Mon Sep 17 00:00:00 2001
531551
From: Karel Zak <kzak@redhat.com>
531551
Date: Thu, 1 Jun 2017 12:07:41 +0200
531551
Subject: [PATCH] lscpu: improve for offline CPUs on AMD
531551
531551
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1457744
531551
Signed-off-by: Karel Zak <kzak@redhat.com>
531551
---
531551
 sys-utils/lscpu.c | 8 ++++----
531551
 1 file changed, 4 insertions(+), 4 deletions(-)
531551
531551
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
531551
index 683fd66..1ee73f3 100644
531551
--- a/sys-utils/lscpu.c
531551
+++ b/sys-utils/lscpu.c
531551
@@ -1550,11 +1550,11 @@ get_cell_data(struct lscpu_desc *desc, int idx, int col,
531551
 				 is_cpu_online(desc, cpu) ? _("yes") : _("no"));
531551
 		break;
531551
 	case COL_MAXMHZ:
531551
-		if (desc->maxmhz)
531551
+		if (desc->maxmhz && desc->maxmhz[idx])
531551
 			xstrncpy(buf, desc->maxmhz[idx], bufsz);
531551
 		break;
531551
 	case COL_MINMHZ:
531551
-		if (desc->minmhz)
531551
+		if (desc->minmhz && desc->minmhz[idx])
531551
 			xstrncpy(buf, desc->minmhz[idx], bufsz);
531551
 		break;
531551
 	}
531551
@@ -1897,9 +1897,9 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
531551
 		print_s(_("CPU dynamic MHz:"), desc->dynamic_mhz);
531551
 	if (desc->static_mhz)
531551
 		print_s(_("CPU static MHz:"), desc->static_mhz);
531551
-	if (desc->maxmhz)
531551
+	if (desc->maxmhz && desc->maxmhz[0])
531551
 		print_s(_("CPU max MHz:"), desc->maxmhz[0]);
531551
-	if (desc->minmhz)
531551
+	if (desc->minmhz && desc->minmhz[0])
531551
 		print_s(_("CPU min MHz:"), desc->minmhz[0]);
531551
 	if (desc->bogomips)
531551
 		print_s(_("BogoMIPS:"), desc->bogomips);
531551
-- 
531551
2.9.4
531551