]> git.baikalelectronics.ru Git - kernel.git/commit
net: atm: clean up a range check
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 3 May 2019 12:39:48 +0000 (15:39 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 5 May 2019 17:25:52 +0000 (10:25 -0700)
commitca4f06b5197b8b87149192fdc41e40a2c3489c85
treee3cb2e36234846a202687b87f6b29b029bf8ab0d
parentdcaf26117f2656fab7915808dd12ea715a182337
net: atm: clean up a range check

The code works fine but the problem is that check for negatives is a
no-op:

if (arg < 0)
i = 0;

The "i" value isn't used.  We immediately overwrite it with:

i = array_index_nospec(arg, MAX_LEC_ITF);

The array_index_nospec() macro returns zero if "arg" is out of bounds so
this works, but the dead code is confusing and it doesn't look very
intentional.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/atm/lec.c