Skip to content
Snippets Groups Projects
Commit 25d34b93 authored by Vincent Stehlé's avatar Vincent Stehlé Committed by Tom Rini
Browse files

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: 8fb49b4c ("dm: Add a new uclass driver for VirtIO transport devices")
Signed-off-by: default avatarVincent Stehlé <vincent.stehle@laposte.net>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
parent e420a38f
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment