From: Alejandro Lucero <alejandro.lucero@netronome.com>
To: dev@dpdk.org
Cc: anatoly.burakov@intel.com
Subject: [dpdk-dev] [PATCH] vfio: fix array bounds check
Date: Fri, 12 May 2017 11:18:25 +0100 [thread overview]
Message-ID: <1494584305-36279-1-git-send-email-alejandro.lucero@netronome.com> (raw)
Checking against VFIO_MAX_GROUPS goes beyond the maximum array
index which should be (VFIO_MAX_GROUPS - 1).
Fixes: 94c0776b1bad("support hotplug")
Coverity issue: 144555
Coverity issue: 144556
Coverity issue: 144557
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
lib/librte_eal/linuxapp/eal/eal_vfio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index 5486dca..4816afc 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -189,7 +189,7 @@
int i;
i = get_vfio_group_idx(vfio_group_fd);
- if (i < 0 || i > VFIO_MAX_GROUPS)
+ if (i < 0 || i > (VFIO_MAX_GROUPS - 1))
RTE_LOG(ERR, EAL, " wrong vfio_group index (%d)\n", i);
else
vfio_cfg.vfio_groups[i].devices++;
@@ -201,7 +201,7 @@
int i;
i = get_vfio_group_idx(vfio_group_fd);
- if (i < 0 || i > VFIO_MAX_GROUPS)
+ if (i < 0 || i > (VFIO_MAX_GROUPS - 1))
RTE_LOG(ERR, EAL, " wrong vfio_group index (%d)\n", i);
else
vfio_cfg.vfio_groups[i].devices--;
@@ -213,7 +213,7 @@
int i;
i = get_vfio_group_idx(vfio_group_fd);
- if (i < 0 || i > VFIO_MAX_GROUPS) {
+ if (i < 0 || i > (VFIO_MAX_GROUPS - 1)) {
RTE_LOG(ERR, EAL, " wrong vfio_group index (%d)\n", i);
return -1;
}
--
1.9.1
next reply other threads:[~2017-05-12 10:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-12 10:18 Alejandro Lucero [this message]
2017-05-12 11:04 ` Burakov, Anatoly
2017-06-05 19:01 ` Thomas Monjalon
2017-06-08 8:53 ` Burakov, Anatoly
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=1494584305-36279-1-git-send-email-alejandro.lucero@netronome.com \
--to=alejandro.lucero@netronome.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
/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;
as well as URLs for NNTP newsgroup(s).