Hi,

On 2/17/26 14:29, Kavin Gunasekara wrote:
If extra random bytes are returned, truncate and use the requested number
instead of returning an error.

Signed-off-by: Kavin Gunasekara <[email protected]>

Reviewed-by: Andre Przywara <[email protected]>

Cheers,
Andre

---
  drivers/virtio/virtio_rng.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_rng.c b/drivers/virtio/virtio_rng.c
index 90a371a59cc..c6de62142bb 100644
--- a/drivers/virtio/virtio_rng.c
+++ b/drivers/virtio/virtio_rng.c
@@ -46,7 +46,7 @@ static int virtio_rng_read(struct udevice *dev, void *data, 
size_t len)
                        ;
if (rsize > sg.length)
-                       return -EIO;
+                       rsize = sg.length;
memcpy(ptr, buf, rsize);
                len -= rsize;

Reply via email to