Re: [PATCH 03/14] resource: add walk_system_ram_res_rev()

From: AKASHI Takahiro
Date: Thu Aug 24 2017 - 20:50:48 EST


On Thu, Aug 24, 2017 at 10:06:28AM +0100, Ard Biesheuvel wrote:
> On 24 August 2017 at 09:18, AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx> wrote:
> > + /* create a list */
> > + rams = vmalloc(sizeof(struct resource) * count);
> > + if (!rams)
> > + return ret;
> > +
> > + res.start = start;
> > + res.end = end;
> > + res.flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> > + orig_end = res.end;
> > + i = 0;
> > + while ((res.start < res.end) &&
> > + (!find_next_iomem_res(&res, IORES_DESC_NONE, true))) {
> > + if (i >= count) {
> > + /* unlikely but */
> > + vfree(rams);
> > + count += 16;
>
> If the count is likely to be < 16, why are we using vmalloc() here?

Ah, you're right :)

-Takahiro AKASHI