summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGal Pressman <galpress@amazon.com>2019-01-07 17:27:54 +0200
committerBen Hutchings <ben@decadent.org.uk>2019-07-09 22:03:45 +0100
commitf6fc768f97d08a018e57b405b6151e666b3286ff (patch)
tree4164aebce82ddd577e2889ab8ea7c6302f8b9778
parent215bf080de689930ce95ad026a59a61ab28d664a (diff)
downloadlinux-stable-f6fc768f97d08a018e57b405b6151e666b3286ff.tar.gz
linux-stable-f6fc768f97d08a018e57b405b6151e666b3286ff.tar.bz2
linux-stable-f6fc768f97d08a018e57b405b6151e666b3286ff.zip
IB/usnic: Fix out of bounds index check in query pkey
commit 4959d5da5737dd804255c75b8cea0a2929ce279a upstream. The pkey table size is one element, index should be tested for > 0 instead of > 1. Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver") Signed-off-by: Gal Pressman <galpress@amazon.com> Acked-by: Parvi Kaustubhi <pkaustub@cisco.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_verbs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index 806432ad21bf..b97e123826a1 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -410,7 +410,7 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index,
u16 *pkey)
{
- if (index > 1)
+ if (index > 0)
return -EINVAL;
*pkey = 0xffff;