* [PATCH] x86: Function missing integer return value
@ 2022-05-05 11:32 Li kunyu
2022-05-05 11:36 ` Juergen Gross
0 siblings, 1 reply; 5+ messages in thread
From: Li kunyu @ 2022-05-05 11:32 UTC (permalink / raw)
To: pbonzini, seanjc, vkuznets, wanpengli, jmattson, joro, tglx,
mingo, bp, dave.hansen, hpa
Cc: x86, kvm, linux-kernel, Li kunyu
This function may need to return a value
Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
arch/x86/kvm/mmu/mmu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 64a2a7e2be90..68f33b932f94 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -6500,6 +6500,8 @@ static int kvm_nx_lpage_recovery_worker(struct kvm *kvm, uintptr_t data)
kvm_recover_nx_lpages(kvm);
}
+
+ return 0;
}
int kvm_mmu_post_init_vm(struct kvm *kvm)
--
2.18.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Function missing integer return value
2022-05-05 11:32 [PATCH] x86: Function missing integer return value Li kunyu
@ 2022-05-05 11:36 ` Juergen Gross
2022-05-05 13:37 ` Maciej S. Szmigiero
0 siblings, 1 reply; 5+ messages in thread
From: Juergen Gross @ 2022-05-05 11:36 UTC (permalink / raw)
To: Li kunyu, pbonzini, seanjc, vkuznets, wanpengli, jmattson, joro,
tglx, mingo, bp, dave.hansen, hpa
Cc: x86, kvm, linux-kernel
[-- Attachment #1.1.1: Type: text/plain, Size: 651 bytes --]
On 05.05.22 13:32, Li kunyu wrote:
> This function may need to return a value
>
> Signed-off-by: Li kunyu <kunyu@nfschina.com>
> ---
> arch/x86/kvm/mmu/mmu.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 64a2a7e2be90..68f33b932f94 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -6500,6 +6500,8 @@ static int kvm_nx_lpage_recovery_worker(struct kvm *kvm, uintptr_t data)
>
> kvm_recover_nx_lpages(kvm);
> }
> +
> + return 0;
This statement is not reachable, so the patch is adding unneeded dead
code only.
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Function missing integer return value
2022-05-05 11:36 ` Juergen Gross
@ 2022-05-05 13:37 ` Maciej S. Szmigiero
2022-05-05 13:40 ` Paolo Bonzini
2022-05-05 15:28 ` Li kunyu
0 siblings, 2 replies; 5+ messages in thread
From: Maciej S. Szmigiero @ 2022-05-05 13:37 UTC (permalink / raw)
To: Juergen Gross, Li kunyu
Cc: x86, kvm, linux-kernel, pbonzini, vkuznets, wanpengli, jmattson,
joro, tglx, mingo, bp, dave.hansen, hpa, seanjc
On 5.05.2022 13:36, Juergen Gross wrote:
> On 05.05.22 13:32, Li kunyu wrote:
>> This function may need to return a value
>>
>> Signed-off-by: Li kunyu <kunyu@nfschina.com>
>> ---
>> arch/x86/kvm/mmu/mmu.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
>> index 64a2a7e2be90..68f33b932f94 100644
>> --- a/arch/x86/kvm/mmu/mmu.c
>> +++ b/arch/x86/kvm/mmu/mmu.c
>> @@ -6500,6 +6500,8 @@ static int kvm_nx_lpage_recovery_worker(struct kvm *kvm, uintptr_t data)
>> kvm_recover_nx_lpages(kvm);
>> }
>> +
>> + return 0;
>
> This statement is not reachable, so the patch is adding unneeded dead
> code only.
Maybe some static checker isn't smart enough to figure this out.
In this case it would probably be better to also change:
> if (kthread_should_stop())
> return 0;
into:
> if (kthread_should_stop())
> break;
so the newly introduced code isn't dead.
> Juergen
Thanks,
Maciej
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Function missing integer return value
2022-05-05 13:37 ` Maciej S. Szmigiero
@ 2022-05-05 13:40 ` Paolo Bonzini
2022-05-05 15:28 ` Li kunyu
1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2022-05-05 13:40 UTC (permalink / raw)
To: Maciej S. Szmigiero, Juergen Gross, Li kunyu
Cc: x86, kvm, linux-kernel, vkuznets, wanpengli, jmattson, joro,
tglx, mingo, bp, dave.hansen, hpa, seanjc
On 5/5/22 15:37, Maciej S. Szmigiero wrote:
>> This statement is not reachable, so the patch is adding unneeded dead
>> code only.
>
> Maybe some static checker isn't smart enough to figure this out.
The static checker really should be improved. This is a while(true),
not the halting problem. :)
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Function missing integer return value
2022-05-05 13:37 ` Maciej S. Szmigiero
2022-05-05 13:40 ` Paolo Bonzini
@ 2022-05-05 15:28 ` Li kunyu
1 sibling, 0 replies; 5+ messages in thread
From: Li kunyu @ 2022-05-05 15:28 UTC (permalink / raw)
To: mail
Cc: bp, dave.hansen, hpa, jgross, jmattson, joro, kunyu, kvm,
linux-kernel, mingo, pbonzini, seanjc, tglx, vkuznets, wanpengli,
x86
Hello, senior, I've considered break before, but I'm not sure if I want to execute more instructions.
Query break executed one more NOP instruction.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-05 15:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 11:32 [PATCH] x86: Function missing integer return value Li kunyu
2022-05-05 11:36 ` Juergen Gross
2022-05-05 13:37 ` Maciej S. Szmigiero
2022-05-05 13:40 ` Paolo Bonzini
2022-05-05 15:28 ` Li kunyu
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).