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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,
				u16 *pkey)
{
	if (index > 1)
	if (index > 0)
		return -EINVAL;

	*pkey = 0xffff;