[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iDVLhDbJZXsoOQ915O4X3MVxHeQx=3Y=1+AYYa5=WgPw@mail.gmail.com>
Date: Thu, 6 Jan 2022 18:55:10 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Chen Yu <yu.c.chen@...el.com>,
Yang Yingliang <yangyingliang@...wei.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>
Subject: Re: [PATCH -next] ACPI: pfr_update: Fix return value check in pfru_write()
On Thu, Jan 6, 2022 at 9:42 AM Chen Yu <yu.c.chen@...el.com> wrote:
>
> On Thu, Jan 06, 2022 at 03:54:48PM +0800, Yang Yingliang wrote:
> > In case of error, memremap() returns NULL pointer not
> > ERR_PTR(). The IS_ERR() test in the return value check
> > should be replaced with NULL test.
> >
> > Fixes: 0db89fa243e5 ("ACPI: Introduce Platform Firmware Runtime Update device driver")
> > Reported-by: Hulk Robot <hulkci@...wei.com>
> > Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> > ---
> > drivers/acpi/pfr_update.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/acpi/pfr_update.c b/drivers/acpi/pfr_update.c
> > index 149b5b2530b9..6bb0b778b5da 100644
> > --- a/drivers/acpi/pfr_update.c
> > +++ b/drivers/acpi/pfr_update.c
> > @@ -460,8 +460,8 @@ static ssize_t pfru_write(struct file *file, const char __user *buf,
> > /* map the communication buffer */
> > phy_addr = (phys_addr_t)((buf_info.addr_hi << 32) | buf_info.addr_lo);
> > buf_ptr = memremap(phy_addr, buf_info.buf_size, MEMREMAP_WB);
> > - if (IS_ERR(buf_ptr))
> > - return PTR_ERR(buf_ptr);
> > + if (!buf_ptr)
> > + return -ENOMEM;
> >
> > if (!copy_from_iter_full(buf_ptr, len, &iter)) {
> > ret = -EINVAL;
> > --
> > 2.25.1
> >
> Acked-by: Chen Yu <yu.c.chen@...el.com>
Applied, thanks!
Powered by blists - more mailing lists