diff mbox series

[PULL,1/3] Fix cacheline detection on FreeBSD/powerpc.

Message ID 20190702123713.14396-2-laurent@vivier.eu
State New
Headers show
Series [PULL,1/3] Fix cacheline detection on FreeBSD/powerpc. | expand

Commit Message

Laurent Vivier July 2, 2019, 12:37 p.m. UTC
From: Justin Hibbits <chmeeedalf@gmail.com>

machdep.cacheline_size is an integer, not a long.  Since PowerPC is
big-endian this causes sysctlbyname() to fill in the upper bits of the
argument, rather than the correct 'lower bits' of the word.  Specify the
correct type to fix this.

Fixes: b255b2c8a548 ("util: add cacheinfo")
Signed-off-by: Justin Hibbits <chmeeedalf@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190607135653.6ece685d@titan.knownspace>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 util/cacheinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/util/cacheinfo.c b/util/cacheinfo.c
index eebe1ce9c5d2..516f837748a3 100644
--- a/util/cacheinfo.c
+++ b/util/cacheinfo.c
@@ -77,7 +77,7 @@  static void sys_cache_info(int *isize, int *dsize)
 static void sys_cache_info(int *isize, int *dsize)
 {
     /* There's only a single sysctl for both I/D cache line sizes.  */
-    long size;
+    int size;
     size_t len = sizeof(size);
     if (!sysctlbyname(SYSCTL_CACHELINE_NAME, &size, &len, NULL, 0)) {
         *isize = *dsize = size;