On Thu, 4 Jun 2020 at 16:55, Philippe Mathieu-Daudé <phi...@redhat.com> wrote:
>
> On 6/4/20 5:30 PM, Peter Maydell wrote:
> > Not really; I think we should know what we're limiting against.
> > Currently you're checking total_len, but this is just sector_len * nb_blocs,
> > so if there's a problem with silly large values then it's probably
> > actually a problem with one of those being over-sized which would
> > still show up even if the total_len was less than 256MB.
> > (I suspect the underlying limit here is what the cfi_table entries
> > 0x2D..0x30 impose on blocks_per_device and sector_len_per_device.)
>
> What I'm working on is a whitelist of the few models our machines really
> use, but it is taking time. Meanwhile I wanted to at least limit the
> total size.

I don't see what we would be whitelisting, though. The only way
to create a flash device is from hand-written C code in the board
model. If a new board model does something weird we can catch that
in code review. Sanity checks on whether the properties supplied
by the board code make sense might be useful; randomly saying
"you can't have a flash device unless it's one we've seen before"
makes less sense to me, because it just means we'll end up adding
to the whitelist every time.

thanks
-- PMM

Reply via email to