Skip to content

Commit

Permalink
virtio-rng: add check of period
Browse files Browse the repository at this point in the history
If period is assigned to 0, limit timer will expire immediately.
It causes a qemu warning:

"main-loop: WARNING: I/O thread spun for 1000 iterations"

This limit is meaningless. This patch forbids to assign 0 to period.

Reviewed-by: Amit Shah <[email protected]>
Signed-off-by: Amos Kong <[email protected]>
Message-id: [email protected]
Signed-off-by: Anthony Liguori <[email protected]>
  • Loading branch information
amoskong authored and Anthony Liguori committed Nov 21, 2013
1 parent 376827d commit d44bb86
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hw/virtio/virtio-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit d44bb86

Please sign in to comment.