]> git.baikalelectronics.ru Git - kernel.git/commit
net/ncsi: prevent a couple array underflows
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 17 May 2018 12:33:36 +0000 (15:33 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 May 2018 20:27:39 +0000 (16:27 -0400)
commit7ab5c6bf7ea301c5c5fd8fef9a6733febbdd988d
tree3e48d9e97348059ec69c00a807df5a3451c4b3ae
parent2198fc69cdf87afc7620986f0ef8cf7f60d93eda
net/ncsi: prevent a couple array underflows

We recently refactored this code and introduced a static checker
warning.  Smatch complains that if cmd->index is zero then we would
underflow the arrays.  That's obviously true.

The question is whether we prevent cmd->index from being zero at a
different level.  I've looked at the code and I don't immediately see
a check for that.

Fixes: 05ba06b5a434 ("net/ncsi: Refactor MAC, VLAN filters")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ncsi/ncsi-rsp.c