mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next] net: prestera: acl: fix 'client_map' buff overflow
@ 2022-02-18 12:29 Volodymyr Mytnyk
  2022-02-19 19:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Volodymyr Mytnyk @ 2022-02-18 12:29 UTC (permalink / raw)
  To: netdev
  Cc: Taras Chornyi, Mickey Rachamim, Serhiy Pshyk, Volodymyr Mytnyk,
	Taras Chornyi, David S. Miller, Jakub Kicinski, linux-kernel

From: Volodymyr Mytnyk <vmytnyk@marvell.com>

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: fa5d824ce5dd ("net: prestera: acl: add multi-chain support offload")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com>
---
 drivers/net/ethernet/marvell/prestera/prestera_acl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_acl.c b/drivers/net/ethernet/marvell/prestera/prestera_acl.c
index 06303e31b32a..e4af8a503277 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_acl.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_acl.c
@@ -97,7 +97,7 @@ int prestera_acl_chain_to_client(u32 chain_index, u32 *client)
 		PRESTERA_HW_COUNTER_CLIENT_LOOKUP_2
 	};
 
-	if (chain_index > ARRAY_SIZE(client_map))
+	if (chain_index >= ARRAY_SIZE(client_map))
 		return -EINVAL;
 
 	*client = client_map[chain_index];
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: prestera: acl: fix 'client_map' buff overflow
  2022-02-18 12:29 [PATCH net-next] net: prestera: acl: fix 'client_map' buff overflow Volodymyr Mytnyk
@ 2022-02-19 19:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-19 19:00 UTC (permalink / raw)
  To: Volodymyr Mytnyk
  Cc: netdev, taras.chornyi, mickeyr, serhiy.pshyk, vmytnyk, tchornyi,
	davem, kuba, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 18 Feb 2022 14:29:11 +0200 you wrote:
> From: Volodymyr Mytnyk <vmytnyk@marvell.com>
> 
> smatch warnings:
> drivers/net/ethernet/marvell/prestera/prestera_acl.c:103
> prestera_acl_chain_to_client() error: buffer overflow
> 'client_map' 3 <= 3
> 
> [...]

Here is the summary with links:
  - [net-next] net: prestera: acl: fix 'client_map' buff overflow
    https://git.kernel.org/netdev/net-next/c/48c77bdf729a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-19 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 12:29 [PATCH net-next] net: prestera: acl: fix 'client_map' buff overflow Volodymyr Mytnyk
2022-02-19 19:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®