[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e6e7b441-9dff-1265-4820-e29ad2ae0e0b@microchip.com>
Date: Thu, 8 Nov 2018 15:00:34 +0000
From: <Tudor.Ambarus@...rochip.com>
To: <boris.brezillon@...tlin.com>
CC: <marek.vasut@...il.com>, <dwmw2@...radead.org>,
<computersforpeace@...il.com>, <richard@....at>,
<linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<yogeshnarayan.gaur@....com>, <cyrille.pitchen@...ev4u.fr>
Subject: Re: [PATCH 3/7] mtd: spi-nor: add restriction for nmaps in smpt
parser
On 11/08/2018 04:54 PM, Boris Brezillon wrote:
> On Thu, 8 Nov 2018 14:48:11 +0000
> <Tudor.Ambarus@...rochip.com> wrote:
>
>>>>>> +
>>>>>
>>>>> Maybe I missed something but it sounds like this change is just
>>>>> optimizing the SPMT parsing a bit, and to be honest, I'm not sure this
>>>>> is really needed. Most of the time, smpt_len will be rather small, so
>>>>> trying to bail out earlier is not bringing much perf improvements.
>>>>
>>>> It's rather a smtp validity check. I want to return an error if there are not
>>>> enough detection commands to identify the map id.
>>>
>>> You would have failed the same way without this validity check after a
>>> maximum of smpt_len iterations, right?
>>>
>>
>> Right. The correct fix would be to count nmaps in a loop, then do these checks,
>> and if all ok, search for the map_id in another loop :).
>
> Or just error out when !ncmds && nmaps > 1.
Solves partially the problem.
>
> If you insist on keeping the ncmds && nmaps >= (1 << (ncmds + 1))
> check, that's fine, but it's not replacing the consistency check I was
> doing ;-).
>
I don't have a strong opinion on this, we can live without these checks as well.
Powered by blists - more mailing lists