* [PATCH -next] virt: vmgenid: fix return value check in vmgenid_acpi_add()
@ 2022-02-26 9:43 Wei Yongjun
2022-02-26 10:07 ` Jason A. Donenfeld
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2022-02-26 9:43 UTC (permalink / raw)
To: weiyongjun1, Theodore Ts'o, Jason A. Donenfeld
Cc: linux-kernel, kernel-janitors, Hulk Robot
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@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH -next] virt: vmgenid: fix return value check in vmgenid_acpi_add()
2022-02-26 9:43 [PATCH -next] virt: vmgenid: fix return value check in vmgenid_acpi_add() Wei Yongjun
@ 2022-02-26 10:07 ` Jason A. Donenfeld
0 siblings, 0 replies; 2+ messages in thread
From: Jason A. Donenfeld @ 2022-02-26 10:07 UTC (permalink / raw)
To: Wei Yongjun; +Cc: Theodore Ts'o, linux-kernel, kernel-janitors, Hulk Robot
Hi Wei,
Thanks! I'll probably fold this into a v+1 of that patch, as we're
also waiting on some ACPI changes elsewhere. I'll CC you when I do
that.
Regards,
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-26 10:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-26 9:43 [PATCH -next] virt: vmgenid: fix return value check in vmgenid_acpi_add() Wei Yongjun
2022-02-26 10:07 ` Jason A. Donenfeld
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®