public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lscpu: read_hypervisor_dmi: only fallback to memory scan on x86/x86_64
@ 2014-03-04  4:39 Stewart Smith
  2014-03-04 10:51 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Stewart Smith @ 2014-03-04  4:39 UTC (permalink / raw)
  To: Karel Zak, util-linux; +Cc: Stewart Smith

As the comment in the code says, this method is really only valid
on x86 and x86_64, so add a #ifdef for those architectures around
that code block.

This was causing "Program lscpu tried to access /dev/mem between f0000->100000."
warnings on some ppc64 machines.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
 sys-utils/lscpu-dmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys-utils/lscpu-dmi.c b/sys-utils/lscpu-dmi.c
index c416f8e..c82bfc1 100644
--- a/sys-utils/lscpu-dmi.c
+++ b/sys-utils/lscpu-dmi.c
@@ -258,6 +258,7 @@ int read_hypervisor_dmi(void)
 	free(buf);
 
 memory_scan:
+#if defined(__x86_64__) || defined(__i386__)
 	/* Fallback to memory scan (x86, x86_64) */
 	buf = get_mem_chunk(0xF0000, 0x10000, _PATH_DEV_MEM);
 	if (!buf)
@@ -275,7 +276,7 @@ memory_scan:
 		if (rc >= 0)
 			break;
 	}
-
+#endif
 done:
 	free(buf);
 	return rc;
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lscpu: read_hypervisor_dmi: only fallback to memory scan on x86/x86_64
  2014-03-04  4:39 [PATCH] lscpu: read_hypervisor_dmi: only fallback to memory scan on x86/x86_64 Stewart Smith
@ 2014-03-04 10:51 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-03-04 10:51 UTC (permalink / raw)
  To: Stewart Smith; +Cc: util-linux

On Tue, Mar 04, 2014 at 03:39:41PM +1100, Stewart Smith wrote:
>  sys-utils/lscpu-dmi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-04 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-04  4:39 [PATCH] lscpu: read_hypervisor_dmi: only fallback to memory scan on x86/x86_64 Stewart Smith
2014-03-04 10:51 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox