[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH PULL 07/10] hw: rdma: fix an off-by-one issue
From: |
Marcel Apfelbaum |
Subject: |
[Qemu-devel] [PATCH PULL 07/10] hw: rdma: fix an off-by-one issue |
Date: |
Sat, 19 Jan 2019 12:03:12 +0200 |
From: Li Qiang <address@hidden>
In rdma_rm_get_backend_gid_index(), the 'sgid_idx' is used
to index the array 'dev_res->port.gid_tbl' which size is
MAX_PORT_GIDS. Current the 'sgid_idx' may be MAX_PORT_GIDS
thus cause an off-by-one issue.
Spotted by Coverity: CID 1398594
Signed-off-by: Li Qiang <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Marcel Apfelbaum <address@hidden>
---
hw/rdma/rdma_rm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c
index 8bf241e91f..268ff633a4 100644
--- a/hw/rdma/rdma_rm.c
+++ b/hw/rdma/rdma_rm.c
@@ -579,7 +579,7 @@ int rdma_rm_del_gid(RdmaDeviceResources *dev_res,
RdmaBackendDev *backend_dev,
int rdma_rm_get_backend_gid_index(RdmaDeviceResources *dev_res,
RdmaBackendDev *backend_dev, int sgid_idx)
{
- if (unlikely(sgid_idx < 0 || sgid_idx > MAX_PORT_GIDS)) {
+ if (unlikely(sgid_idx < 0 || sgid_idx >= MAX_PORT_GIDS)) {
pr_dbg("Got invalid sgid_idx %d\n", sgid_idx);
return -EINVAL;
}
--
2.17.1
- [Qemu-devel] [PATCH PULL 00/10] RDMA queue, Marcel Apfelbaum, 2019/01/19
- [Qemu-devel] [PATCH PULL 01/10] docs/pvrdma: Update rdmacm-mux documentation, Marcel Apfelbaum, 2019/01/19
- [Qemu-devel] [PATCH PULL 09/10] hw/rdma: modify struct initialization, Marcel Apfelbaum, 2019/01/19
- [Qemu-devel] [PATCH PULL 05/10] hw/pvrdma: Make function pvrdma_qp_send/recv return void., Marcel Apfelbaum, 2019/01/19
- [Qemu-devel] [PATCH PULL 07/10] hw: rdma: fix an off-by-one issue,
Marcel Apfelbaum <=
- [Qemu-devel] [PATCH PULL 08/10] contrib/rdmacm-mux: remove Wno-format-truncation flag, Marcel Apfelbaum, 2019/01/19
- [Qemu-devel] [PATCH PULL 06/10] hw/rdma: Verify that ptr is not NULL before freeing, Marcel Apfelbaum, 2019/01/19
- [Qemu-devel] [PATCH PULL 04/10] hw/pvrdma: Post CQE when receive invalid gid index, Marcel Apfelbaum, 2019/01/19
- [Qemu-devel] [PATCH PULL 03/10] hw/rdma: Delete unused struct member, Marcel Apfelbaum, 2019/01/19
- [Qemu-devel] [PATCH PULL 02/10] hw/pvrdma: Remove max-sge command-line param, Marcel Apfelbaum, 2019/01/19
- [Qemu-devel] [PATCH PULL 10/10] contrib/rdmacm-mux: fix clang compilation, Marcel Apfelbaum, 2019/01/19
- Re: [Qemu-devel] [PATCH PULL 00/10] RDMA queue, 李强, 2019/01/20
- Re: [Qemu-devel] [PATCH PULL 00/10] RDMA queue, Peter Maydell, 2019/01/22