]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/qedr: Fix out of bounds index check in query pkey
authorGal Pressman <galpress@amazon.com>
Mon, 7 Jan 2019 15:27:56 +0000 (17:27 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 11 Jan 2019 00:07:45 +0000 (17:07 -0700)
The pkey table size is QEDR_ROCE_PKEY_TABLE_LEN, index should be tested
for >= QEDR_ROCE_PKEY_TABLE_LEN instead of > QEDR_ROCE_PKEY_TABLE_LEN.

Fixes: a7efd7773e31 ("qedr: Add support for PD,PKEY and CQ verbs")
Signed-off-by: Gal Pressman <galpress@amazon.com>
Acked-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/qedr/verbs.c

index ba8cb6559122e81849bd37daddec3c38a5c7ffbb..b27ff9408507317a8ef6b32cbeee14b01cb2f6c3 100644 (file)
@@ -67,7 +67,7 @@ static inline int qedr_ib_copy_to_udata(struct ib_udata *udata, void *src,
 
 int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
 {
-       if (index > QEDR_ROCE_PKEY_TABLE_LEN)
+       if (index >= QEDR_ROCE_PKEY_TABLE_LEN)
                return -EINVAL;
 
        *pkey = QEDR_ROCE_PKEY_DEFAULT;