Thread (23 messages) 23 messages, 3 authors, 2026-01-29

Re: [net-next,v6,01/13] octeontx2-af: npc: cn20k: Index management

From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-01-29 23:50:11
Also in: lkml

On Thu, 29 Jan 2026 10:53:00 +0530 Ratheesh Kannoth wrote:
quoted
When cnt is odd, the final loop iteration has i = cnt - 1, which means
subbank_srch_order[i + 1] writes to index cnt, which is out of bounds.

For example with cnt = 5, the loop iterates with i = 0, 2, 4. At i = 4,
the array access subbank_srch_order[5] overflows the allocated array of
5 elements.

While CN20K hardware typically has 32 subbanks (even), the value is read
from a hardware register at npc_priv_init() without validation beyond
checking for zero. Could this lead to memory corruption if the hardware
reports an odd subbank count?  
subbank count is 16 or 8, depending on SoC variant. i will add a WARN check on
odd ?
Or just a comment may work to prevent the false positive
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help