mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
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>
This commit is contained in:
@@ -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++)
|
||||
@@ -86,6 +86,10 @@ RESTRICT="!test? ( test )"
|
||||
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-2.37.1-lscpu_nullptr.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
|
||||
Reference in New Issue
Block a user