Use calloc() to avoid uninitialized fields in the rng device. Signed-off-by: Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx> --- virtio/rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtio/rng.c b/virtio/rng.c index f9d607f6..63ab8fce 100644 --- a/virtio/rng.c +++ b/virtio/rng.c @@ -162,7 +162,7 @@ int virtio_rng__init(struct kvm *kvm) if (!kvm->cfg.virtio_rng) return 0; - rdev = malloc(sizeof(*rdev)); + rdev = calloc(1, sizeof(*rdev)); if (rdev == NULL) return -ENOMEM; -- 2.37.1