提交 59a39ca3 编写于 作者: D Dan Carpenter 提交者: Roland Dreier

RDMA/ocrdma: Fix off by one in ocrdma_query_gid()

The ->sgid_tbl[] array has OCRDMA_MAX_SGID number of elements so this
test is off by one.  ->sgid_tbl is allocated in ocrdma_alloc_resources().
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NSelvin Xavier <selvin.xavier@emulex.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 f3070e7e
......@@ -53,7 +53,7 @@ int ocrdma_query_gid(struct ib_device *ibdev, u8 port,
dev = get_ocrdma_dev(ibdev);
memset(sgid, 0, sizeof(*sgid));
if (index > OCRDMA_MAX_SGID)
if (index >= OCRDMA_MAX_SGID)
return -EINVAL;
memcpy(sgid, &dev->sgid_tbl[index], sizeof(*sgid));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册