Skip to content

Commit

Permalink
RDMA/ocrdma: Fix off by one in ocrdma_query_gid()
Browse files Browse the repository at this point in the history
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 <dan.carpenter@oracle.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
  • Loading branch information
Dan Carpenter authored and Roland Dreier committed Jun 14, 2012
1 parent a3698a9 commit 7b33dc2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 7b33dc2

Please sign in to comment.