]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: Test array index before use
authorFlorian Fainelli <f.fainelli@gmail.com>
Sun, 12 Jul 2015 01:02:10 +0000 (18:02 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 12 Jul 2015 06:25:16 +0000 (23:25 -0700)
commit69e74b191148077f263c3b68daa6a97247aa9758
tree09864acdea8b4c1ef6ed6a9d4f0b159f25d9ef28
parentc6fd45538d1094677aa39c18fd46af12cca11a8f
net: dsa: Test array index before use

port_index is used an index into an array, and this information comes
from Device Tree, make sure that port_index is not equal to the array
size before using it. Move the check against port_index earlier in the
loop.

Fixes: fab19bfb3f33: ("dsa: add device tree bindings to register DSA switches")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa.c