- hw/virtio/virtio-pmem: Replace impossible check by assertion - tests: Fix printf format string in acpi-utils.c - softmmu/dirtylimit: Add parameter check for hmp "set_vcpu_dirty_limit" - disas/riscv: Fix the typo of inverted order of pmpaddr13 and pmpaddr14 - qga: Fix memory leak when output stream is unused - ui/vnc-clipboard: fix infinite loop in inflate_buffer (CVE-2023-3255) - target/i386: Add few security fix bits in ARCH_CAPABILITIES into SapphireRapids CPU model - target/i386: Add new bit definitions of MSR_IA32_ARCH_CAPABILITIES - target/i386: Allow MCDT_NO if host supports - target/i386: Add support for MCDT_NO in CPUID enumeration - target/i386: Export MSR_ARCH_CAPABILITIES bits to guests - target/i386: add support for FB_CLEAR feature - target/i386: add support for FLUSH_L1D feature - crypto: remove shadowed 'ret' variable - hw/i2c/pmbus_device: Fix modifying QOM class internals from instance - hw/arm/xlnx-zynqmp: fix unsigned error when checking the RPUs number Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
56 lines
1.9 KiB
Diff
56 lines
1.9 KiB
Diff
From 381500cc0b96e85165ae0314839c34976a4da1b2 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?=
|
|
<yong.huang@smartx.com>
|
|
Date: Fri, 18 Nov 2022 10:08:54 +0800
|
|
Subject: [PATCH] softmmu/dirtylimit: Add parameter check for hmp
|
|
"set_vcpu_dirty_limit"
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
dirty_rate paraemter of hmp command "set_vcpu_dirty_limit" is invalid
|
|
if less than 0, so add parameter check for it.
|
|
|
|
Note that this patch also delete the unsolicited help message and
|
|
clean up the code.
|
|
|
|
Signed-off-by: Hyman Huang(黄勇) <yong.huang@smartx.com>
|
|
Reviewed-by: Markus Armbruster <armbru@redhat.com>
|
|
Reviewed-by: Peter Xu <peterx@redhat.com>
|
|
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
Message-Id: <168618975839.6361.17407633874747688653-1@git.sr.ht>
|
|
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
---
|
|
softmmu/dirtylimit.c | 13 +++++++------
|
|
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c
|
|
index 8d98cb7f2c..5041c230d0 100644
|
|
--- a/softmmu/dirtylimit.c
|
|
+++ b/softmmu/dirtylimit.c
|
|
@@ -515,14 +515,15 @@ void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
|
|
int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
|
|
Error *err = NULL;
|
|
|
|
- qmp_set_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, dirty_rate, &err);
|
|
- if (err) {
|
|
- hmp_handle_error(mon, err);
|
|
- return;
|
|
+ if (dirty_rate < 0) {
|
|
+ error_setg(&err, "invalid dirty page limit %" PRId64, dirty_rate);
|
|
+ goto out;
|
|
}
|
|
|
|
- monitor_printf(mon, "[Please use 'info vcpu_dirty_limit' to query "
|
|
- "dirty limit for virtual CPU]\n");
|
|
+ qmp_set_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, dirty_rate, &err);
|
|
+
|
|
+out:
|
|
+ hmp_handle_error(mon, err);
|
|
}
|
|
|
|
static struct DirtyLimitInfo *dirtylimit_query_vcpu(int cpu_index)
|
|
--
|
|
2.41.0.windows.1
|
|
|