Re: [PATCH v3 6/7] firmware: coreboot: Only populate devices in coreboot_table_init()
From: Stephen Boyd
Date: Thu Aug 09 2018 - 19:43:37 EST
Quoting Julius Werner (2018-08-09 14:02:53)
> On Thu, Aug 9, 2018 at 10:17 AM Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
> > @@ -162,26 +143,37 @@ static int coreboot_table_probe(struct platform_device *pdev)
> > if (!res->start || !len)
> > return -EINVAL;
> >
> > + /* Map and check just the header first to make sure things are sane */
> > header = memremap(res->start, sizeof(*header), MEMREMAP_WB);
> > - if (header == NULL)
> > + if (!header)
> > return -ENOMEM;
> >
> > - ptr = memremap(res->start, header->header_bytes + header->table_bytes,
> > - MEMREMAP_WB);
> > + if (strncmp(header->signature, "LBIO", sizeof(header->signature))) {
> > + dev_warn(dev, "coreboot table missing or corrupt!\n");
> > + return -ENODEV;
>
> Leaking the mapping here.
Thanks. Fixed.