Commit 4959d5da authored by Gal Pressman's avatar Gal Pressman Committed by Jason Gunthorpe

IB/usnic: Fix out of bounds index check in query pkey

The pkey table size is one element, index should be tested for > 0 instead
of > 1.

Fixes: e3cf00d0 ("IB/usnic: Add Cisco VIC low-level hardware driver")
Signed-off-by: default avatarGal Pressman <galpress@amazon.com>
Acked-by: default avatarParvi Kaustubhi <pkaustub@cisco.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent b0ea0fa5
...@@ -449,7 +449,7 @@ struct net_device *usnic_get_netdev(struct ib_device *device, u8 port_num) ...@@ -449,7 +449,7 @@ struct net_device *usnic_get_netdev(struct ib_device *device, u8 port_num)
int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index, int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index,
u16 *pkey) u16 *pkey)
{ {
if (index > 1) if (index > 0)
return -EINVAL; return -EINVAL;
*pkey = 0xffff; *pkey = 0xffff;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment