Re: [PATCH net] net: atm: clean up a range check

2019-05-05 Thread David Miller
From: Dan Carpenter Date: Fri, 3 May 2019 15:39:48 +0300 > 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_

[PATCH net] net: atm: clean up a range check

2019-05-03 Thread Dan Carpenter
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 b