From f47ea7ddbe38d6f6a121bbdd365701062cd864de Mon Sep 17 00:00:00 2001 From: jsg Date: Sat, 3 Feb 2024 09:53:15 +0000 Subject: [PATCH] not enough bits for L1 cache size to be >= 1M found by "mask and shift to zero: expr='totalsize >> 10'" smatch warning --- sys/arch/amd64/amd64/cacheinfo.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sys/arch/amd64/amd64/cacheinfo.c b/sys/arch/amd64/amd64/cacheinfo.c index 6996d6f27d8..acee9fd2d32 100644 --- a/sys/arch/amd64/amd64/cacheinfo.c +++ b/sys/arch/amd64/amd64/cacheinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cacheinfo.c,v 1.11 2022/07/12 04:46:00 jsg Exp $ */ +/* $OpenBSD: cacheinfo.c,v 1.12 2024/02/03 09:53:15 jsg Exp $ */ /* * Copyright (c) 2022 Jonathan Gray @@ -43,10 +43,7 @@ amd64_print_l1_cacheinfo(struct cpu_info *ci) printf("%s: ", ci->ci_dev->dv_xname); - if (totalsize < 1024) - printf("%dKB ", totalsize); - else - printf("%dMB ", totalsize >> 10); + printf("%dKB ", totalsize); printf("%db/line ", linesize); switch (ways) { @@ -70,10 +67,7 @@ amd64_print_l1_cacheinfo(struct cpu_info *ci) ways = (edx >> 16) & 0xff; totalsize = (edx >> 24) & 0xff; /* KB */ - if (totalsize < 1024) - printf("%dKB ", totalsize); - else - printf("%dMB ", totalsize >> 10); + printf("%dKB ", totalsize); printf("%db/line ", linesize); switch (ways) { -- 2.20.1