[patch] remoteproc: off by one in rproc_virtio_new_vringh()

From: Dan Carpenter
Date: Fri Feb 22 2013 - 01:07:08 EST


It should be >= ARRAY_SIZE() instead of > ARRAY_SIZE() because it
is an index.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index dba33ff..b5e3af5 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -208,7 +208,7 @@ rproc_virtio_new_vringh(struct virtio_device *vdev, unsigned index,
struct vringh *vrh;
int err;

- if (index > ARRAY_SIZE(rvdev->vring)) {
+ if (index >= ARRAY_SIZE(rvdev->vring)) {
dev_err(&rvdev->vdev.dev, "bad vring index: %d\n", index);
return NULL;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/