"Fossies" - the Fresh Open Source Software Archive 
Member "ipfire-2.x-2.27-core174/src/patches/cpufrequtils/0003-cpufrequtils-aperf-Fix-MSR-read-on-32-bit.patch" (7 Apr 2023, 1286 Bytes) of package /linux/misc/ipfire-2.x-2.27-core174.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 From d4490efed068a552e8b67d52a0726458a224c9a0 Mon Sep 17 00:00:00 2001
2 From: Frank Arnold <frank.arnold@amd.com>
3 Date: Wed, 8 Dec 2010 17:39:14 +0100
4 Subject: [PATCH 3/8] cpufrequtils aperf: Fix MSR read on 32-bit
5
6 The cpufreq-aperf command does not work on 32-bit systems. The reason
7 for that is a wrong count argument passed to the read() call. Instead
8 of the buffer size, the size of the pointer to the buffer is used. On
9 64-bit systems this just happened to work, because we need to read an
10 8 byte value and a pointer has a size of 8 bytes on 64-bit. On 32-bit
11 systems only 4 bytes are read, which then triggers the error path.
12
13 Signed-off-by: Frank Arnold <frank.arnold@amd.com>
14 Reviewed-by: Thomas Renninger <trenn@suse.de>
15 Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
16 ---
17 utils/aperf.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20 diff --git a/utils/aperf.c b/utils/aperf.c
21 index 1c64501..6302f5a 100644
22 --- a/utils/aperf.c
23 +++ b/utils/aperf.c
24 @@ -100,7 +100,7 @@ static int read_msr(int cpu, unsigned int idx, unsigned long long *val)
25 return -1;
26 if (lseek(fd, idx, SEEK_CUR) == -1)
27 goto err;
28 - if (read(fd, val, sizeof val) != sizeof *val)
29 + if (read(fd, val, sizeof *val) != sizeof *val)
30 goto err;
31 close(fd);
32 return 0;
33 --
34 1.7.10
35