代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libvirt 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From bfcbf70e99b9fb06468de8135d3a251ef22e0cd3 Mon Sep 17 00:00:00 2001
From: Michal Privoznik <[email protected]>
Date: Mon, 14 Jun 2021 12:46:02 +0200
Subject: [PATCH 094/108] Don't call qsort() over NULL
In a few places it may happen that the array we want to sort is
still NULL (e.g. because there were no leases found, no paths for
secdriver to lock or no cache banks). However, passing NULL to
qsort() is undefined and even though glibc plays nicely we
shouldn't rely on undefined behaviour.
Signed-off-by: Michal Privoznik <[email protected]>
Reviewed-by: Tim Wiederhake <[email protected]>
(cherry picked from commit 1ab5a37c4a70434a1dacebbdababb91baaa29ef1)
---
src/conf/capabilities.c | 6 ++++--
src/security/security_manager.c | 3 ++-
tools/nss/libvirt_nss.c | 3 ++-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index d6ec1f12f4..deb99cecd3 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -1982,8 +1982,10 @@ virCapabilitiesInitCaches(virCapsPtr caps)
/* Sort the array in order for the tests to be predictable. This way we can
* still traverse the directory instead of guessing names (in case there is
* 'index1' and 'index3' but no 'index2'). */
- qsort(caps->host.cache.banks, caps->host.cache.nbanks,
- sizeof(*caps->host.cache.banks), virCapsHostCacheBankSorter);
+ if (caps->host.cache.banks) {
+ qsort(caps->host.cache.banks, caps->host.cache.nbanks,
+ sizeof(*caps->host.cache.banks), virCapsHostCacheBankSorter);
+ }
if (virCapabilitiesInitResctrlMemory(caps) < 0)
goto cleanup;
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 9d5dfec12b..a74b663685 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -1302,7 +1302,8 @@ virSecurityManagerMetadataLock(virSecurityManagerPtr mgr G_GNUC_UNUSED,
* paths in the same order and thus no deadlock can occur.
* Lastly, it makes searching for duplicate paths below
* simpler. */
- qsort(paths, npaths, sizeof(*paths), cmpstringp);
+ if (paths)
+ qsort(paths, npaths, sizeof(*paths), cmpstringp);
for (i = 0; i < npaths; i++) {
const char *p = paths[i];
diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index 3b89f72742..265ef236cc 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -69,7 +69,8 @@ static void
sortAddr(leaseAddress *tmpAddress,
size_t ntmpAddress)
{
- qsort(tmpAddress, ntmpAddress, sizeof(*tmpAddress), leaseAddressSorter);
+ if (tmpAddress)
+ qsort(tmpAddress, ntmpAddress, sizeof(*tmpAddress), leaseAddressSorter);
}
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。