Message ID | 20220505113218.93520-1-kunyu@nfschina.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86: Function missing integer return value | expand |
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
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
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
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.
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)
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(+)