[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220226094331.3268683-1-weiyongjun1@huawei.com>
Date: Sat, 26 Feb 2022 09:43:31 +0000
From: Wei Yongjun <weiyongjun1@...wei.com>
To: <weiyongjun1@...wei.com>, Theodore Ts'o <tytso@....edu>,
"Jason A. Donenfeld" <Jason@...c4.com>
CC: <linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>,
Hulk Robot <hulkci@...wei.com>
Subject: [PATCH -next] virt: vmgenid: fix return value check in vmgenid_acpi_add()
In case of error, the function devm_memremap() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().
Fixes: d54207b61470 ("virt: vmgenid: introduce driver for reinitializing RNG on VM fork")
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
---
drivers/virt/vmgenid.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c
index b503c210c2d7..344f6fcc01da 100644
--- a/drivers/virt/vmgenid.c
+++ b/drivers/virt/vmgenid.c
@@ -50,8 +50,8 @@ static int vmgenid_acpi_add(struct acpi_device *device)
phys_addr = (obj->package.elements[0].integer.value << 0) |
(obj->package.elements[1].integer.value << 32);
state->next_id = devm_memremap(&device->dev, phys_addr, VMGENID_SIZE, MEMREMAP_WB);
- if (!state->next_id) {
- ret = -ENOMEM;
+ if (IS_ERR(state->next_id)) {
+ ret = PTR_ERR(state->next_id);
goto out;
}
Powered by blists - more mailing lists