]> 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)
commit2ce561455ae9a371fe238af8905fdd5c7390f451
tree09864acdea8b4c1ef6ed6a9d4f0b159f25d9ef28
parent7ea78d1980d51899b034b8cfc3abb04a94d1fde1
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: 5ece5786c868: ("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