Skip to content

Commit 48c77bd

Browse files
Volodymyr Mytnykdavem330
authored andcommitted
net: prestera: acl: fix 'client_map' buff overflow
smatch warnings: drivers/net/ethernet/marvell/prestera/prestera_acl.c:103 prestera_acl_chain_to_client() error: buffer overflow 'client_map' 3 <= 3 prestera_acl_chain_to_client(u32 chain_index, ...) ... u32 client_map[] = { PRESTERA_HW_COUNTER_CLIENT_LOOKUP_0, PRESTERA_HW_COUNTER_CLIENT_LOOKUP_1, PRESTERA_HW_COUNTER_CLIENT_LOOKUP_2 }; if (chain_index > ARRAY_SIZE(client_map)) ... Fixes: fa5d824 ("net: prestera: acl: add multi-chain support offload") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Volodymyr Mytnyk <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 173a272 commit 48c77bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/marvell/prestera/prestera_acl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int prestera_acl_chain_to_client(u32 chain_index, u32 *client)
9797
PRESTERA_HW_COUNTER_CLIENT_LOOKUP_2
9898
};
9999

100-
if (chain_index > ARRAY_SIZE(client_map))
100+
if (chain_index >= ARRAY_SIZE(client_map))
101101
return -EINVAL;
102102

103103
*client = client_map[chain_index];

0 commit comments

Comments
 (0)