All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio: fix off by one device id comparison
@ 2021-02-14 18:39 Vincent Stehlé
  2021-02-15 10:04 ` Bin Meng
  2021-02-25 13:25 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Vincent Stehlé @ 2021-02-14 18:39 UTC (permalink / raw)
  To: u-boot

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? <vincent.stehle@laposte.net>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] virtio: fix off by one device id comparison
  2021-02-14 18:39 [PATCH] virtio: fix off by one device id comparison Vincent Stehlé
@ 2021-02-15 10:04 ` Bin Meng
  2021-02-25 13:25 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Bin Meng @ 2021-02-15 10:04 UTC (permalink / raw)
  To: u-boot

On Mon, Feb 15, 2021 at 4:24 PM Vincent Stehl?
<vincent.stehle@laposte.net> 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? <vincent.stehle@laposte.net>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> ---
>  drivers/virtio/virtio-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] virtio: fix off by one device id comparison
  2021-02-14 18:39 [PATCH] virtio: fix off by one device id comparison Vincent Stehlé
  2021-02-15 10:04 ` Bin Meng
@ 2021-02-25 13:25 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-02-25 13:25 UTC (permalink / raw)
  To: u-boot

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? <vincent.stehle@laposte.net>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot/master, thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-25 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 18:39 [PATCH] virtio: fix off by one device id comparison Vincent Stehlé
2021-02-15 10:04 ` Bin Meng
2021-02-25 13:25 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.