mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
hwrng: virtio - use snprintf() in probe_common()
While the current code works correctly, replace the unbounded sprintf() with the safer snprintf() to follow secure coding best practices. Signed-off-by: Thorsten Blum <blum@kernel.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
468dd85acf
commit
98807de9ac
|
|
@ -162,7 +162,7 @@ static int probe_common(struct virtio_device *vdev)
|
|||
err = index;
|
||||
goto err_ida;
|
||||
}
|
||||
sprintf(vi->name, "virtio_rng.%d", index);
|
||||
snprintf(vi->name, sizeof(vi->name), "virtio_rng.%d", vi->index);
|
||||
init_completion(&vi->have_data);
|
||||
|
||||
vi->hwrng = (struct hwrng) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user