From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ohad Ben-Cohen <ohad@wizery.com>
Cc: open list <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: [patch] remoteproc: off by one in rproc_virtio_new_vringh()
Date: Fri, 22 Feb 2013 09:05:50 +0300 [thread overview]
Message-ID: <20130222060159.GA15816@longonot.mountain> (raw)
It should be >= ARRAY_SIZE() instead of > ARRAY_SIZE() because it
is an index.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
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;
}
reply other threads:[~2013-02-22 6:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130222060159.GA15816@longonot.mountain \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ohad@wizery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox