Skip to contentSkip to conversation

setarch: don't return address of automatic variable

PATCH Applied Andreas Schwab 2 participants 2 messages Jan 19, 2019 – Jan 22, 2019 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 setarch: don't return address of automatic variable

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
---
 sys-utils/setarch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sys-utils/setarch.c +1 -1
index 7c0a63fbb262..703c36d864e1 100644
@@ -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[] =
Signature · 7 lines
2.20.1


-- 
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."
maintainer Applied
#1 lore raw
Quoted 2 lines · Andreas Schwab
 sys-utils/setarch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com