Commit 1ac0991f authored by Gal Pressman's avatar Gal Pressman Committed by Kleber Sacilotto de Souza

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

BugLink: https://bugs.launchpad.net/bugs/1864773

[ Upstream commit 4959d5da ]

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>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent c6eba17a
...@@ -427,7 +427,7 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index, ...@@ -427,7 +427,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, 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