aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Arnold <frank.arnold@amd.com>2010-12-08 17:39:14 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2010-12-12 10:06:31 +0100
commitd4490efed068a552e8b67d52a0726458a224c9a0 (patch)
treeb90e6f720638d88ba92db47b10bbcc0cff950444
parentadb7e044755aa06b12212d05c4acbcccb023d2cd (diff)
downloadcpufrequtils-d4490efed068a552e8b67d52a0726458a224c9a0.tar.gz
cpufrequtils aperf: Fix MSR read on 32-bit
The cpufreq-aperf command does not work on 32-bit systems. The reason for that is a wrong count argument passed to the read() call. Instead of the buffer size, the size of the pointer to the buffer is used. On 64-bit systems this just happened to work, because we need to read an 8 byte value and a pointer has a size of 8 bytes on 64-bit. On 32-bit systems only 4 bytes are read, which then triggers the error path. Signed-off-by: Frank Arnold <frank.arnold@amd.com> Reviewed-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--utils/aperf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/aperf.c b/utils/aperf.c
index 1c64501..6302f5a 100644
--- a/utils/aperf.c
+++ b/utils/aperf.c
@@ -100,7 +100,7 @@ static int read_msr(int cpu, unsigned int idx, unsigned long long *val)
return -1;
if (lseek(fd, idx, SEEK_CUR) == -1)
goto err;
- if (read(fd, val, sizeof val) != sizeof *val)
+ if (read(fd, val, sizeof *val) != sizeof *val)
goto err;
close(fd);
return 0;