aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio/virtio-rng.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index 314e393520..b22ccf1008 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -139,6 +139,12 @@ static int virtio_rng_device_init(VirtIODevice *vdev)
VirtIORNG *vrng = VIRTIO_RNG(vdev);
Error *local_err = NULL;
+ if (!vrng->conf.period_ms > 0) {
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "period",
+ "a positive number");
+ return -1;
+ }
+
if (vrng->conf.rng == NULL) {
vrng->conf.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM));