提交 d44bb860 编写于 作者: A Amos Kong 提交者: Anthony Liguori

virtio-rng: add check of period

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: NAmit Shah <amit.shah@redhat.com>
Signed-off-by: NAmos Kong <akong@redhat.com>
Message-id: 1385031203-23790-1-git-send-email-akong@redhat.com
Signed-off-by: NAnthony Liguori <aliguori@amazon.com>
上级 376827d4
......@@ -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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册