Skip to content

Commit 648db19

Browse files
committed
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2020-04-29' into staging
Miscellaneous patches for 2020-04-29 # gpg: Signature made Wed 29 Apr 2020 07:42:52 BST # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "[email protected]" # gpg: Good signature from "Markus Armbruster <[email protected]>" [full] # gpg: aka "Markus Armbruster <[email protected]>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-misc-2020-04-29: (32 commits) qemu-option: pass NULL rather than 0 to the id of qemu_opts_set() libqos: Give get_machine_allocator() internal linkage fuzz: Simplify how we compute available machines and types Makefile: Drop unused, broken target recurse-fuzz smbus: Fix spd_data_generate() for number of banks > 2 bamboo, sam460ex: Tidy up error message for unsupported RAM size smbus: Fix spd_data_generate() error API violation sam460ex: Suppress useless warning on -m 32 and -m 64 qga: Fix qmp_guest_suspend_{disk, ram}() error handling qga: Fix qmp_guest_get_memory_blocks() error handling tests/test-logging: Fix test for -dfilter 0..0xffffffffffffffff migration/colo: Fix qmp_xen_colo_do_checkpoint() error handling io: Fix qio_channel_socket_close() error handling xen/pt: Fix flawed conversion to realize() virtio-net: Fix duplex=... and speed=... error handling bochs-display: Fix vgamem=SIZE error handling fdc: Fix fallback=auto error handling arm/virt: Fix virt_machine_device_plug_cb() error API violation cpus: Proper range-checking for -icount shift=N cpus: Fix configure_icount() error API violation ... Signed-off-by: Peter Maydell <[email protected]>
2 parents a7922a3 + 8ef3a4b commit 648db19

37 files changed

+384
-354
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ $(ROM_DIRS_RULES):
582582

583583
.PHONY: recurse-all recurse-clean recurse-install
584584
recurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS))
585-
recurse-fuzz: $(addsuffix /fuzz, $(TARGET_DIRS) $(ROM_DIRS))
586585
recurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS))
587586
recurse-install: $(addsuffix /install, $(TARGET_DIRS))
588587
$(addsuffix /install, $(TARGET_DIRS)): all

backends/cryptodev-builtin.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,7 @@ static int cryptodev_builtin_sym_close_session(
282282
CryptoDevBackendBuiltin *builtin =
283283
CRYPTODEV_BACKEND_BUILTIN(backend);
284284

285-
if (session_id >= MAX_NUM_SESSIONS ||
286-
builtin->sessions[session_id] == NULL) {
287-
error_setg(errp, "Cannot find a valid session id: %" PRIu64 "",
288-
session_id);
289-
return -1;
290-
}
285+
assert(session_id < MAX_NUM_SESSIONS && builtin->sessions[session_id]);
291286

292287
qcrypto_cipher_free(builtin->sessions[session_id]->cipher);
293288
g_free(builtin->sessions[session_id]);
@@ -356,8 +351,7 @@ static void cryptodev_builtin_cleanup(
356351

357352
for (i = 0; i < MAX_NUM_SESSIONS; i++) {
358353
if (builtin->sessions[i] != NULL) {
359-
cryptodev_builtin_sym_close_session(
360-
backend, i, 0, errp);
354+
cryptodev_builtin_sym_close_session(backend, i, 0, &error_abort);
361355
}
362356
}
363357

block/file-posix.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2691,10 +2691,13 @@ static void check_cache_dropped(BlockDriverState *bs, Error **errp)
26912691
vec_end = DIV_ROUND_UP(length, page_size);
26922692
for (i = 0; i < vec_end; i++) {
26932693
if (vec[i] & 0x1) {
2694-
error_setg(errp, "page cache still in use!");
26952694
break;
26962695
}
26972696
}
2697+
if (i < vec_end) {
2698+
error_setg(errp, "page cache still in use!");
2699+
break;
2700+
}
26982701
}
26992702

27002703
if (window) {

block/replication.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ static void replication_child_perm(BlockDriverState *bs, BdrvChild *c,
172172
if ((bs->open_flags & (BDRV_O_INACTIVE | BDRV_O_RDWR)) == BDRV_O_RDWR) {
173173
*nperm |= BLK_PERM_WRITE;
174174
}
175-
*nshared = BLK_PERM_CONSISTENT_READ \
176-
| BLK_PERM_WRITE \
175+
*nshared = BLK_PERM_CONSISTENT_READ
176+
| BLK_PERM_WRITE
177177
| BLK_PERM_WRITE_UNCHANGED;
178178
return;
179179
}

block/vhdx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,20 +2206,20 @@ static QemuOptsList vhdx_create_opts = {
22062206
.name = VHDX_BLOCK_OPT_BLOCK_SIZE,
22072207
.type = QEMU_OPT_SIZE,
22082208
.def_value_str = stringify(0),
2209-
.help = "Block Size; min 1MB, max 256MB. " \
2209+
.help = "Block Size; min 1MB, max 256MB. "
22102210
"0 means auto-calculate based on image size."
22112211
},
22122212
{
22132213
.name = BLOCK_OPT_SUBFMT,
22142214
.type = QEMU_OPT_STRING,
2215-
.help = "VHDX format type, can be either 'dynamic' or 'fixed'. "\
2215+
.help = "VHDX format type, can be either 'dynamic' or 'fixed'. "
22162216
"Default is 'dynamic'."
22172217
},
22182218
{
22192219
.name = VHDX_BLOCK_OPT_ZERO,
22202220
.type = QEMU_OPT_BOOL,
2221-
.help = "Force use of payload blocks of type 'ZERO'. "\
2222-
"Non-standard, but default. Do not set to 'off' when "\
2221+
.help = "Force use of payload blocks of type 'ZERO'. "
2222+
"Non-standard, but default. Do not set to 'off' when "
22232223
"using 'qemu-img convert' with subformat=dynamic."
22242224
},
22252225
{ NULL }

cpus.c

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "qemu/osdep.h"
2626
#include "qemu-common.h"
2727
#include "qemu/config-file.h"
28+
#include "qemu/cutils.h"
2829
#include "migration/vmstate.h"
2930
#include "monitor/monitor.h"
3031
#include "qapi/error.h"
@@ -797,40 +798,47 @@ void cpu_ticks_init(void)
797798

798799
void configure_icount(QemuOpts *opts, Error **errp)
799800
{
800-
const char *option;
801-
char *rem_str = NULL;
801+
const char *option = qemu_opt_get(opts, "shift");
802+
bool sleep = qemu_opt_get_bool(opts, "sleep", true);
803+
bool align = qemu_opt_get_bool(opts, "align", false);
804+
long time_shift = -1;
802805

803-
option = qemu_opt_get(opts, "shift");
804-
if (!option) {
805-
if (qemu_opt_get(opts, "align") != NULL) {
806-
error_setg(errp, "Please specify shift option when using align");
807-
}
806+
if (!option && qemu_opt_get(opts, "align")) {
807+
error_setg(errp, "Please specify shift option when using align");
808808
return;
809809
}
810810

811-
icount_sleep = qemu_opt_get_bool(opts, "sleep", true);
812-
if (icount_sleep) {
813-
timers_state.icount_warp_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL_RT,
814-
icount_timer_cb, NULL);
815-
}
816-
817-
icount_align_option = qemu_opt_get_bool(opts, "align", false);
818-
819-
if (icount_align_option && !icount_sleep) {
811+
if (align && !sleep) {
820812
error_setg(errp, "align=on and sleep=off are incompatible");
813+
return;
821814
}
815+
822816
if (strcmp(option, "auto") != 0) {
823-
errno = 0;
824-
timers_state.icount_time_shift = strtol(option, &rem_str, 0);
825-
if (errno != 0 || *rem_str != '\0' || !strlen(option)) {
817+
if (qemu_strtol(option, NULL, 0, &time_shift) < 0
818+
|| time_shift < 0 || time_shift > MAX_ICOUNT_SHIFT) {
826819
error_setg(errp, "icount: Invalid shift value");
820+
return;
827821
}
828-
use_icount = 1;
829-
return;
830822
} else if (icount_align_option) {
831823
error_setg(errp, "shift=auto and align=on are incompatible");
824+
return;
832825
} else if (!icount_sleep) {
833826
error_setg(errp, "shift=auto and sleep=off are incompatible");
827+
return;
828+
}
829+
830+
icount_sleep = sleep;
831+
if (icount_sleep) {
832+
timers_state.icount_warp_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL_RT,
833+
icount_timer_cb, NULL);
834+
}
835+
836+
icount_align_option = align;
837+
838+
if (time_shift >= 0) {
839+
timers_state.icount_time_shift = time_shift;
840+
use_icount = 1;
841+
return;
834842
}
835843

836844
use_icount = 2;

dump/dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ static void dump_process(DumpState *s, Error **errp)
18921892
result = qmp_query_dump(NULL);
18931893
/* should never fail */
18941894
assert(result);
1895-
qapi_event_send_dump_completed(result, !!local_err, (local_err ? \
1895+
qapi_event_send_dump_completed(result, !!local_err, (local_err ?
18961896
error_get_pretty(local_err) : NULL));
18971897
qapi_free_DumpQueryResult(result);
18981898

hw/arm/virt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ static void create_smmu(const VirtMachineState *vms,
11861186
g_free(node);
11871187
}
11881188

1189-
static void create_virtio_iommu_dt_bindings(VirtMachineState *vms, Error **errp)
1189+
static void create_virtio_iommu_dt_bindings(VirtMachineState *vms)
11901190
{
11911191
const char compat[] = "virtio,pci-iommu";
11921192
uint16_t bdf = vms->virtio_iommu_bdf;
@@ -2118,7 +2118,7 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
21182118

21192119
vms->iommu = VIRT_IOMMU_VIRTIO;
21202120
vms->virtio_iommu_bdf = pci_get_bdf(pdev);
2121-
create_virtio_iommu_dt_bindings(vms, errp);
2121+
create_virtio_iommu_dt_bindings(vms);
21222122
}
21232123
}
21242124

hw/block/fdc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,6 +2615,7 @@ static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl,
26152615

26162616
if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) {
26172617
error_setg(errp, "Cannot choose a fallback FDrive type of 'auto'");
2618+
return;
26182619
}
26192620

26202621
/* Fill 'command_to_handler' lookup table */

hw/display/bochs-display.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,16 +267,18 @@ static void bochs_display_realize(PCIDevice *dev, Error **errp)
267267
Object *obj = OBJECT(dev);
268268
int ret;
269269

270-
s->con = graphic_console_init(DEVICE(dev), 0, &bochs_display_gfx_ops, s);
271-
272270
if (s->vgamem < 4 * MiB) {
273271
error_setg(errp, "bochs-display: video memory too small");
272+
return;
274273
}
275274
if (s->vgamem > 256 * MiB) {
276275
error_setg(errp, "bochs-display: video memory too big");
276+
return;
277277
}
278278
s->vgamem = pow2ceil(s->vgamem);
279279

280+
s->con = graphic_console_init(DEVICE(dev), 0, &bochs_display_gfx_ops, s);
281+
280282
memory_region_init_ram(&s->vram, obj, "bochs-display-vram", s->vgamem,
281283
&error_fatal);
282284
memory_region_init_io(&s->vbe, obj, &bochs_display_vbe_ops, s,

0 commit comments

Comments
 (0)