[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190505.102611.257025800032151893.davem@davemloft.net>
Date: Sun, 05 May 2019 10:26:11 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: dan.carpenter@...cle.com
Cc: gustavo@...eddedor.com, dwmw2@...radead.org,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net] net: atm: clean up a range check
From: Dan Carpenter <dan.carpenter@...cle.com>
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_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@...cle.com>
> ---
> This applies to net, but it's just a clean up.
I'm applying this to net-next, thanks Dan.
Powered by blists - more mailing lists