From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Fri, 22 Feb 2013 06:05:50 +0000 Subject: [patch] remoteproc: off by one in rproc_virtio_new_vringh() Message-Id: <20130222060159.GA15816@longonot.mountain> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Ohad Ben-Cohen Cc: open list , kernel-janitors@vger.kernel.org It should be >= ARRAY_SIZE() instead of > ARRAY_SIZE() because it is an index. Signed-off-by: Dan Carpenter 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; }