From: Andreas Schwab <schwab@linux-m68k.org>
To: util-linux@vger.kernel.org
Subject: [PATCH] setarch: don't return address of automatic variable
Date: Sat, 19 Jan 2019 23:18:16 +0100 [thread overview]
Message-ID: <87imyk9tqv.fsf@igel.home> (raw)
On architectures without special personalities setarch uses the contents
of a local variable with automatic storage duration after return from
the function, causing it to report a spurious error.
$ setarch m68k
setarch: Kernel cannot set architecture to m68k
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
sys-utils/setarch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 7c0a63fbb262..703c36d864e1 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -131,7 +131,7 @@ static void __attribute__((__noreturn__)) usage(int archwrapper)
*/
static struct arch_domain *init_arch_domains(void)
{
- struct utsname un;
+ static struct utsname un;
size_t i;
static struct arch_domain transitions[] =
--
2.20.1
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
next reply other threads:[~2019-01-19 22:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-19 22:18 Andreas Schwab [this message]
2019-01-22 11:02 ` [PATCH] setarch: don't return address of automatic variable Karel Zak
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=87imyk9tqv.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=util-linux@vger.kernel.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