* [PATCH] KVM: PPC: Book3S HV: Remove NULL check before kfree
@ 2020-04-05 9:10 Qiujun Huang
0 siblings, 0 replies; 3+ messages in thread
From: Qiujun Huang @ 2020-04-05 9:10 UTC (permalink / raw)
To: paulus, benh, mpe; +Cc: Qiujun Huang, linuxppc-dev, linux-kernel, kvm-ppc
NULL check before kfree is unnecessary, so remove it.
This issue was detected by using the Coccinelle software.
Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
---
arch/powerpc/kvm/book3s_hv_nested.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c
index dc97e5be76f6..cad324312040 100644
--- a/arch/powerpc/kvm/book3s_hv_nested.c
+++ b/arch/powerpc/kvm/book3s_hv_nested.c
@@ -1416,8 +1416,7 @@ static long int __kvmhv_nested_page_fault(struct kvm_run *run,
rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
ret = kvmppc_create_pte(kvm, gp->shadow_pgtable, pte, n_gpa, level,
mmu_seq, gp->shadow_lpid, rmapp, &n_rmap);
- if (n_rmap)
- kfree(n_rmap);
+ kfree(n_rmap);
if (ret == -EAGAIN)
ret = RESUME_GUEST; /* Let the guest try again */
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Remove NULL check before kfree
@ 2020-04-05 20:50 Markus Elfring
2020-04-06 1:14 ` Qiujun Huang
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2020-04-05 20:50 UTC (permalink / raw)
To: Qiujun Huang, kvm-ppc, linuxppc-dev; +Cc: Chen Zhou, linux-kernel
> NULL check before kfree is unnecessary, so remove it.
Would you like to take similar update suggestions into account?
* 2019-09-04
KVM: PPC: Book3S HV: Delete an unnecessary check before kfree() in __kvmhv_nested_page_fault()
* [-next] KVM: PPC: Book3S HV: remove redundant NULL check
https://lkml.kernel.org/lkml/20200401130903.6576-1-chenzhou10@huawei.com/
https://lore.kernel.org/patchwork/patch/1218800/
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-06 1:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-05 9:10 [PATCH] KVM: PPC: Book3S HV: Remove NULL check before kfree Qiujun Huang
-- strict thread matches above, loose matches on Subject: below --
2020-04-05 20:50 Markus Elfring
2020-04-06 1:14 ` Qiujun Huang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).