]> git.baikalelectronics.ru Git - kernel.git/commit
net: lan966x: fix a couple off by one bugs
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 21 Apr 2022 15:46:13 +0000 (18:46 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Apr 2022 10:25:37 +0000 (11:25 +0100)
commitc6bd3959ec9b36ec7606c3340706156629c68b9a
treefa203e08bc40fedd9fe7c952dea07a3dfec44d87
parent194739e1347f798a34a333ab69622da8b8a620fb
net: lan966x: fix a couple off by one bugs

The lan966x->ports[] array has lan966x->num_phys_ports elements.  These
are assigned in lan966x_probe().  That means the > comparison should be
changed to >=.

The first off by one check is harmless but the second one could lead to
an out of bounds access and a crash.

Fixes: ab3e5f5e79c6 ("net: lan966x: add support for interrupts from analyzer")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/lan966x/lan966x_mac.c