Re: [PATCH] ACPI, APEI, Fix use resource_size

From: Borislav Petkov
Date: Wed Dec 13 2017 - 10:39:13 EST


On Wed, Dec 13, 2017 at 01:19:55AM +0100, Rafael J. Wysocki wrote:
> On Monday, December 11, 2017 4:44:31 PM CET Vasyl Gomonovych wrote:
> > Use resource_size function on resource object
> > Underneath __request_region set res->end to start + n - 1
> > Lets use resourse_size to set value properly.
> >
> > Signed-off-by: Vasyl Gomonovych <gomonovych@xxxxxxxxx>
>
> Boris, what do you think?

So if MAINTAINERS says we review apei stuff, it doesn't mean that you
should completely stop doing that! :-P

So this looks like a fix to me since it didn't do the + 1 before.

I don't believe this would break any APEI stuff but it should be tested
a little just in case.

> > ---
> > drivers/acpi/apei/apei-base.c | 13 ++++++-------
> > 1 file changed, 6 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
> > index da370e1..af712a8 100644
> > --- a/drivers/acpi/apei/apei-base.c
> > +++ b/drivers/acpi/apei/apei-base.c
> > @@ -506,8 +506,7 @@ int apei_resources_request(struct apei_resources *resources,
> >
> > rc = -EINVAL;
> > list_for_each_entry(res, &resources->iomem, list) {
> > - r = request_mem_region(res->start, res->end - res->start,
> > - desc);
> > + r = request_mem_region(res->start, resource_size(res), desc);

Jeez, this is silly: we compute resource size just so that __request_region()
can "uncompute" it back:

res->start = start;
res->end = start + n - 1;

Lovely.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.