Re: [PATCH] virtio: fix off by one device id comparison

2021-02-25 Thread Tom Rini
On Sun, Feb 14, 2021 at 07:39:04PM +0100, Vincent Stehlé wrote:

> 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é 
> Cc: Simon Glass 
> Cc: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] virtio: fix off by one device id comparison

2021-02-15 Thread Vincent Stehlé
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é 
Cc: Simon Glass 
Cc: Bin Meng 
---
 drivers/virtio/virtio-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c
index cf2cfaef2cf..0379536c542 100644
--- a/drivers/virtio/virtio-uclass.c
+++ b/drivers/virtio/virtio-uclass.c
@@ -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;
-- 
2.29.2



Re: [PATCH] virtio: fix off by one device id comparison

2021-02-15 Thread Bin Meng
On Mon, Feb 15, 2021 at 4:24 PM Vincent Stehlé
 wrote:
>
> 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é 
> Cc: Simon Glass 
> Cc: Bin Meng 
> ---
>  drivers/virtio/virtio-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng