hw: rdma: fix an off-by-one issue
commita5fe209d71f311afb0035ce39e9472f9b31445e9
authorLi Qiang <liq3ea@163.com>
Thu, 3 Jan 2019 13:12:51 +0000 (3 05:12 -0800)
committerMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
Sat, 19 Jan 2019 08:57:48 +0000 (19 10:57 +0200)
tree0974b7b5373ad6f92c0522e30de422ef931e4ed4
parenta1aa88b7dcac2b22d74908f9276d5d145d8e65a0
hw: rdma: fix an off-by-one issue

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 <liq3ea@163.com>
Message-Id: <20190103131251.49271-1-liq3ea@163.com>
Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
hw/rdma/rdma_rm.c