util/cacheinfo: fix crash when compiling with uClibc
This commit is contained in:
parent
289abf1b2b
commit
eefa614339
@ -1,6 +1,6 @@
|
|||||||
Name: qemu
|
Name: qemu
|
||||||
Version: 4.1.0
|
Version: 4.1.0
|
||||||
Release: 54
|
Release: 55
|
||||||
Epoch: 2
|
Epoch: 2
|
||||||
Summary: QEMU is a generic and open source machine emulator and virtualizer
|
Summary: QEMU is a generic and open source machine emulator and virtualizer
|
||||||
License: GPLv2 and BSD and MIT and CC-BY-SA-4.0
|
License: GPLv2 and BSD and MIT and CC-BY-SA-4.0
|
||||||
@ -324,6 +324,7 @@ Patch0311: nvram-add-nrf51_soc-flash-read-method.patch
|
|||||||
Patch0312: spapr_pci-add-spapr-msi-read-method.patch
|
Patch0312: spapr_pci-add-spapr-msi-read-method.patch
|
||||||
Patch0313: tz-ppc-add-dummy-read-write-methods.patch
|
Patch0313: tz-ppc-add-dummy-read-write-methods.patch
|
||||||
Patch0314: imx7-ccm-add-digprog-mmio-write-method.patch
|
Patch0314: imx7-ccm-add-digprog-mmio-write-method.patch
|
||||||
|
Patch0315: util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
|
||||||
|
|
||||||
BuildRequires: flex
|
BuildRequires: flex
|
||||||
BuildRequires: bison
|
BuildRequires: bison
|
||||||
@ -713,6 +714,9 @@ getent passwd qemu >/dev/null || \
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed 19 May 2021 zhouli57 <zhouli57@huawei.com>
|
||||||
|
- util/cacheinfo: fix crash when compiling with uClibc
|
||||||
|
|
||||||
* Fri Mar 26 2021 Chen Qun <kuhn.chenqun@huawei.com>
|
* Fri Mar 26 2021 Chen Qun <kuhn.chenqun@huawei.com>
|
||||||
- hw/pci-host: add pci-intack write method
|
- hw/pci-host: add pci-intack write method
|
||||||
- pci-host: add pcie-msi read method
|
- pci-host: add pcie-msi read method
|
||||||
|
|||||||
45
util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
Normal file
45
util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
From 00b5032eaddb7193f03f0a28b10286244d2e2a7b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Santos <casantos@redhat.com>
|
||||||
|
Date: Thu, 17 Oct 2019 09:37:13 -0300
|
||||||
|
Subject: [PATCH] util/cacheinfo: fix crash when compiling with uClibc
|
||||||
|
|
||||||
|
uClibc defines _SC_LEVEL1_ICACHE_LINESIZE and _SC_LEVEL1_DCACHE_LINESIZE
|
||||||
|
but the corresponding sysconf calls returns -1, which is a valid result,
|
||||||
|
meaning that the limit is indeterminate.
|
||||||
|
|
||||||
|
Handle this situation using the fallback values instead of crashing due
|
||||||
|
to an assertion failure.
|
||||||
|
|
||||||
|
Signed-off-by: Carlos Santos <casantos@redhat.com>
|
||||||
|
Message-Id: <20191017123713.30192-1-casantos@redhat.com>
|
||||||
|
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
|
||||||
|
---
|
||||||
|
util/cacheinfo.c | 10 ++++++++--
|
||||||
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/util/cacheinfo.c b/util/cacheinfo.c
|
||||||
|
index ea6f3e99bf..d94dc6adc8 100644
|
||||||
|
--- a/util/cacheinfo.c
|
||||||
|
+++ b/util/cacheinfo.c
|
||||||
|
@@ -93,10 +93,16 @@ static void sys_cache_info(int *isize, int *dsize)
|
||||||
|
static void sys_cache_info(int *isize, int *dsize)
|
||||||
|
{
|
||||||
|
# ifdef _SC_LEVEL1_ICACHE_LINESIZE
|
||||||
|
- *isize = sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
|
||||||
|
+ int tmp_isize = (int) sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
|
||||||
|
+ if (tmp_isize > 0) {
|
||||||
|
+ *isize = tmp_isize;
|
||||||
|
+ }
|
||||||
|
# endif
|
||||||
|
# ifdef _SC_LEVEL1_DCACHE_LINESIZE
|
||||||
|
- *dsize = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
|
||||||
|
+ int tmp_dsize = (int) sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
|
||||||
|
+ if (tmp_dsize > 0) {
|
||||||
|
+ *dsize = tmp_dsize;
|
||||||
|
+ }
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
#endif /* sys_cache_info */
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user