Skip to content

Commit

Permalink
ACPI: pfr_update: Fix return value check in pfru_write()
Browse files Browse the repository at this point in the history
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: 0db89fa ("ACPI: Introduce Platform Firmware Runtime Update device driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Yang Yingliang authored and Rafael J. Wysocki committed Jan 6, 2022
1 parent 53e8558 commit 31834aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/acpi/pfr_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 31834aa

Please sign in to comment.