[dpdk-dev] vfio: fix array bounds check
Checks
Commit Message
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(-)
Comments
> From: Alejandro Lucero [mailto:alejandro.lucero@netronome.com]
> Sent: Friday, May 12, 2017 11:18 AM
> To: dev@dpdk.org
> Cc: Burakov, Anatoly <anatoly.burakov@intel.com>
> Subject: [PATCH] vfio: fix array bounds check
>
> 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>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
12/05/2017 13:04, Burakov, Anatoly:
> > From: Alejandro Lucero [mailto:alejandro.lucero@netronome.com]
> >
> > 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>
>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Applied, thanks
Anatoly, you are often inserting two spaces between your first name
and last name. Recurring typo?
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Monday, June 5, 2017 8:01 PM
> To: Alejandro Lucero <alejandro.lucero@netronome.com>
> Cc: dev@dpdk.org; Burakov, Anatoly <anatoly.burakov@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] vfio: fix array bounds check
>
> 12/05/2017 13:04, Burakov, Anatoly:
> > > From: Alejandro Lucero [mailto:alejandro.lucero@netronome.com]
> > >
> > > 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>
> >
> > Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
>
> Applied, thanks
>
> Anatoly, you are often inserting two spaces between your first name and last
> name. Recurring typo?
Probably git misconfiguration. Thanks!
@@ -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;
}