[PATCH v2 2/2] virtio: rng: Handle oversized return buffers

Andre Przywara andre.przywara at arm.com
Thu Mar 19 14:01:23 CET 2026


Hi,

looks like I gave my Reviewed-by tag already on v1, please remember to 
carry that over in a subsequent submission.
For the records:

On 3/9/26 17:55, Meet Patel wrote:
> From: Kavin Gunasekara <kavin.gunasekara at arm.com>
> 
> If extra random bytes are returned, truncate and use the requested number
> instead of returning an error.
> 
> Signed-off-by: Kavin Gunasekara <kavin.gunasekara at arm.com>
> Signed-off-by: Meet Patel <meet.patel2 at arm.com>

Reviewed-by: Andre Przywara <andre.przywara at arm.com>

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;



More information about the U-Boot mailing list