Skip to content

Commit 7b33dc2

Browse files
Dan Carpenterrolandd
authored andcommitted
RDMA/ocrdma: Fix off by one in ocrdma_query_gid()
The dev->sgid_tbl[] array is allocated in ocrdma_alloc_resources(). It has OCRDMA_MAX_SGID elements so the test here is off by one. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent a3698a9 commit 7b33dc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/ocrdma/ocrdma_verbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int ocrdma_query_gid(struct ib_device *ibdev, u8 port,
5353

5454
dev = get_ocrdma_dev(ibdev);
5555
memset(sgid, 0, sizeof(*sgid));
56-
if (index > OCRDMA_MAX_SGID)
56+
if (index >= OCRDMA_MAX_SGID)
5757
return -EINVAL;
5858

5959
memcpy(sgid, &dev->sgid_tbl[index], sizeof(*sgid));

0 commit comments

Comments
 (0)