From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-acpi@vger.kernel.org>
Cc: <rafael@kernel.org>, <lenb@kernel.org>, <yu.c.chen@intel.com>
Subject: [PATCH -next] ACPI: pfr_update: Fix return value check in pfru_write()
Date: Thu, 6 Jan 2022 15:54:48 +0800 [thread overview]
Message-ID: <20220106075448.3215141-1-yangyingliang@huawei.com> (raw)
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@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.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
next reply other threads:[~2022-01-06 7:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 7:54 Yang Yingliang [this message]
2022-01-06 8:42 ` [PATCH -next] ACPI: pfr_update: Fix return value check in pfru_write() Chen Yu
2022-01-06 17:55 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220106075448.3215141-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=yu.c.chen@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox