public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Stewart Smith <stewart@linux.vnet.ibm.com>
To: Karel Zak <kzak@redhat.com>, util-linux@vger.kernel.org
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>
Subject: [PATCH] lscpu: read_hypervisor_dmi: only fallback to memory scan on x86/x86_64
Date: Tue,  4 Mar 2014 15:39:41 +1100	[thread overview]
Message-ID: <1393907981-24298-1-git-send-email-stewart@linux.vnet.ibm.com> (raw)

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


             reply	other threads:[~2014-03-04  4:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04  4:39 Stewart Smith [this message]
2014-03-04 10:51 ` [PATCH] lscpu: read_hypervisor_dmi: only fallback to memory scan on x86/x86_64 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=1393907981-24298-1-git-send-email-stewart@linux.vnet.ibm.com \
    --to=stewart@linux.vnet.ibm.com \
    --cc=kzak@redhat.com \
    --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