summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2021-07-30 13:16:59 +0100
committerMarek Szuba <marecki@gentoo.org>2021-07-30 13:20:58 +0100
commita8c8e0a371b8b48481ff8d79c0841e20a8ce78d8 (patch)
treeb3952e04148c978e6c3d9fc091a7774e0a9595de /sys-apps/util-linux
parentnet-libs/nodejs: add 14.17.4 (diff)
downloadgentoo-a8c8e0a371b8b48481ff8d79c0841e20a8ce78d8.tar.gz
gentoo-a8c8e0a371b8b48481ff8d79c0841e20a8ce78d8.tar.bz2
gentoo-a8c8e0a371b8b48481ff8d79c0841e20a8ce78d8.zip
sys-apps/util-linux-2.37.1: fix lscpu segfault on some arches
Observed on rv64 but could in princple happen elsewhere too. Bug: https://bugs.gentoo.org/802606 Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'sys-apps/util-linux')
-rw-r--r--sys-apps/util-linux/files/util-linux-2.37.1-lscpu_nullptr.patch26
-rw-r--r--sys-apps/util-linux/util-linux-2.37.1.ebuild4
2 files changed, 30 insertions, 0 deletions
diff --git a/sys-apps/util-linux/files/util-linux-2.37.1-lscpu_nullptr.patch b/sys-apps/util-linux/files/util-linux-2.37.1-lscpu_nullptr.patch
new file mode 100644
index 00000000000..bfb528cf1f1
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.37.1-lscpu_nullptr.patch
@@ -0,0 +1,26 @@
+If you call a function which can return a null pointer you probably want
+to check the return value before attempting to dereference it. </sarcasm>
+
+--- a/sys-utils/lscpu.c
++++ b/sys-utils/lscpu.c
+@@ -966,7 +966,7 @@
+ *(p - 2) = '\0';
+ add_summary_s(tb, sec, _("CPU op-mode(s):"), buf);
+ }
+- if (ct->addrsz)
++ if (ct && ct->addrsz)
+ add_summary_s(tb, sec, _("Address sizes:"), ct->addrsz);
+ #if !defined(WORDS_BIGENDIAN)
+ add_summary_s(tb, sec, _("Byte Order:"), "Little Endian");
+@@ -1008,9 +1008,9 @@
+ sec = NULL;
+
+ /* Section: cpu type description */
+- if (ct->vendor)
++ if (ct && ct->vendor)
+ sec = add_summary_s(tb, NULL, _("Vendor ID:"), ct->vendor);
+- if (ct->bios_vendor)
++ if (ct && ct->bios_vendor)
+ add_summary_s(tb, sec, _("BIOS Vendor ID:"), ct->bios_vendor);
+
+ for (i = 0; i < cxt->ncputypes; i++)
diff --git a/sys-apps/util-linux/util-linux-2.37.1.ebuild b/sys-apps/util-linux/util-linux-2.37.1.ebuild
index 141bdf409cb..c12359853f4 100644
--- a/sys-apps/util-linux/util-linux-2.37.1.ebuild
+++ b/sys-apps/util-linux/util-linux-2.37.1.ebuild
@@ -86,6 +86,10 @@ RESTRICT="!test? ( test )"
S="${WORKDIR}/${MY_P}"
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.37.1-lscpu_nullptr.patch
+)
+
src_prepare() {
default