public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Marek Szuba" <marecki@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/util-linux/, sys-apps/util-linux/files/
Date: Fri, 30 Jul 2021 12:21:05 +0000 (UTC)	[thread overview]
Message-ID: <1627647658.a8c8e0a371b8b48481ff8d79c0841e20a8ce78d8.marecki@gentoo> (raw)

commit:     a8c8e0a371b8b48481ff8d79c0841e20a8ce78d8
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 30 12:16:59 2021 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Fri Jul 30 12:20:58 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8c8e0a3

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 <AT> gentoo.org>

 .../files/util-linux-2.37.1-lscpu_nullptr.patch    | 26 ++++++++++++++++++++++
 sys-apps/util-linux/util-linux-2.37.1.ebuild       |  4 ++++
 2 files changed, 30 insertions(+)

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
 


             reply	other threads:[~2021-07-30 12:21 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 12:21 Marek Szuba [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-08  6:59 [gentoo-commits] repo/gentoo:master commit in: sys-apps/util-linux/, sys-apps/util-linux/files/ Sam James
2024-05-20 15:06 Mike Gilbert
2024-05-11 17:19 Mike Gilbert
2024-04-04  1:17 Sam James
2024-03-28  4:55 Sam James
2024-03-22  0:12 Matt Turner
2023-12-28  2:57 Sam James
2023-05-26  7:24 Sam James
2023-05-23  4:20 Sam James
2023-05-23  3:14 Sam James
2023-03-19  6:07 Sam James
2023-02-09  3:54 Sam James
2022-01-24 16:02 Sam James
2021-10-03 11:28 David Seifert
2021-08-16 14:02 Lars Wendler
2021-08-11 12:30 Lars Wendler
2021-07-10 21:31 Lars Wendler
2021-06-02 21:14 Georgy Yakovlev
2021-05-23 12:14 David Seifert
2020-12-22 14:43 Andreas K. Hüttel
2020-11-16 17:36 Lars Wendler
2020-03-25 14:14 Thomas Deutschmann
2019-05-31  0:58 Lars Wendler
2018-12-29 17:45 Mikle Kolyada
2018-07-13 16:41 Patrick McLean
2018-04-10 19:29 Thomas Deutschmann
2017-12-17 15:48 Lars Wendler
2017-06-09  1:19 Lars Wendler
2017-01-21  0:36 Lars Wendler
2015-09-07 20:02 Lars Wendler
2015-09-07 18:30 Michał Górny
2015-09-07 14:37 Lars Wendler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1627647658.a8c8e0a371b8b48481ff8d79c0841e20a8ce78d8.marecki@gentoo \
    --to=marecki@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox