virtio: fix off by one device id comparison
PATCH 1/1 virtio: fix off by one device id comparison
VIRTIO_ID_MAX_NUM is the largest device ID plus 1. Therefore a device id cannot be greater or equal to VIRTIO_ID_MAX_NUM. Fix the comparison accordingly.
Fixes 8fb49b4c7a82 ("dm: Add a new uclass driver for VirtIO transport devices")
Signed-off-by Vincent Stehl? <[email protected]>
Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
--- drivers/virtio/virtio-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio-uclass.c +1 -1
@@ -227,7 +227,7 @@ static int virtio_uclass_post_probe(struct udevice *udev)struct udevice *vdev;int ret; -if (uc_priv->device >VIRTIO_ID_MAX_NUM ) { +if (uc_priv->device >=VIRTIO_ID_MAX_NUM ) {debug ("(%s): virtio device ID %d exceeds maximum num\n" , udev->name, uc_priv->device);return 0 ;
Signature · 1 line
2.29.2
PATCH 1/1 virtio: fix off by one device id comparison
Quoted 5 lines · Vincent Stehl?
VIRTIO_ID_MAX_NUMis the largest device ID plus 1. Therefore a device id cannot be greater or equal toVIRTIO_ID_MAX_NUM. Fix the comparison accordingly.
Quoted 8 lines
Fixes 8fb49b4c7a82 ("dm: Add a new uclass driver for VirtIO transport devices")Signed-off-by Vincent Stehl? <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>--- drivers/virtio/virtio-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by Bin Meng <[email protected]>
PATCH 1/1 virtio: fix off by one device id comparison
In reply to Vincent StehléQuoted 8 lines · Vincent Stehl?
VIRTIO_ID_MAX_NUMis the largest device ID plus 1. Therefore a device id cannot be greater or equal toVIRTIO_ID_MAX_NUM. Fix the comparison accordingly.Fixes 8fb49b4c7a82 ("dm: Add a new uclass driver for VirtIO transport devices")Signed-off-by Vincent Stehl? <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210225/6e04cd27/attachment.sig>