mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-27 22:56:49 +08:00
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: 8fb49b4c7a
("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>
This commit is contained in:
parent
e420a38fa6
commit
25d34b936c
@ -227,7 +227,7 @@ static int virtio_uclass_post_probe(struct udevice *udev)
|
|||||||
struct udevice *vdev;
|
struct udevice *vdev;
|
||||||
int ret;
|
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",
|
debug("(%s): virtio device ID %d exceeds maximum num\n",
|
||||||
udev->name, uc_priv->device);
|
udev->name, uc_priv->device);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user