KVM: x86/xsave: Remove 'return void' expression for 'void function'
PATCH 1/1 KVM: x86/xsave: Remove 'return void' expression for 'void function'
From: Like Xu <[email protected]>
The requested info will be stored in 'guest_xsave->region' referenced by the incoming pointer "struct kvm_xsave *guest_xsave", thus there is no need to explicitly use return void expression for a void function "static void kvm_vcpu_ioctl_x86_get_xsave(...)". The issue is caught with [-Wpedantic].
--- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/x86.c +2 -2
@@ -5503,8 +5503,8 @@ static void kvm_vcpu_ioctl_x86_get_xsave2(struct kvm_vcpu *vcpu,static void kvm_vcpu_ioctl_x86_get_xsave (struct kvm_vcpu *vcpu,struct kvm_xsave *guest_xsave) { -return kvm_vcpu_ioctl_x86_get_xsave2 (vcpu, (void *)guest_xsave->region, -sizeof (guest_xsave->region)); +kvm_vcpu_ioctl_x86_get_xsave2 (vcpu, (void *)guest_xsave->region, +sizeof (guest_xsave->region)); } static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,
base-commit: 86701e115030e020a052216baa942e8547e0b487
Signature · 1 line
2.42.0
У сб, 2023-10-07 у 14:40 +0800, Like Xu пише:
Quoted 29 lines
From: Like Xu <[email protected]>
The requested info will be stored in '
guest_xsave->region' referenced by the incoming pointer "structkvm_xsave*guest_xsave", thus there is no need to explicitly use return void expression for a void function "static voidkvm_vcpu_ioctl_x86_get_xsave(...)". The issue is caught with [-Wpedantic].Fixes 2d287ec65e79 ("x86/fpu: Allow caller to constrain xfeatures when copying to uabi buffer")Signed-off-by Like Xu <[email protected]>--- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/x86.c +2
-2@@ -5503,8 +5503,8 @@ static void kvm_vcpu_ioctl_x86_get_xsave2(struct kvm_vcpu *vcpu,static void kvm_vcpu_ioctl_x86_get_xsave (struct kvm_vcpu *vcpu,struct kvm_xsave *guest_xsave) { -return kvm_vcpu_ioctl_x86_get_xsave2 (vcpu, (void *)guest_xsave->region, -sizeof (guest_xsave->region)); +kvm_vcpu_ioctl_x86_get_xsave2 (vcpu, (void *)guest_xsave->region, +sizeof (guest_xsave->region)); } static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,
Quoted 1 line
base-commit:
86701e115030e020a052216baa942e8547e0b487
Best regards,
Maxim Levitsky
Emm, did we miss this little fix ?
Quoted 36 lines · Maxim Levitsky
У сб, 2023-10-07 у 14:40 +0800, Like Xu пише:
Quoted 29 lines
From: Like Xu <[email protected]>
The requested info will be stored in '
guest_xsave->region' referenced by the incoming pointer "structkvm_xsave*guest_xsave", thus there is no need to explicitly use return void expression for a void function "static voidkvm_vcpu_ioctl_x86_get_xsave(...)". The issue is caught with [-Wpedantic].Fixes 2d287ec65e79 ("x86/fpu: Allow caller to constrain xfeatures when copying to uabi buffer")Signed-off-by Like Xu <[email protected]>--- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/x86.c +2
-2@@ -5503,8 +5503,8 @@ static void kvm_vcpu_ioctl_x86_get_xsave2(struct kvm_vcpu *vcpu,static void kvm_vcpu_ioctl_x86_get_xsave (struct kvm_vcpu *vcpu,struct kvm_xsave *guest_xsave) { -return kvm_vcpu_ioctl_x86_get_xsave2 (vcpu, (void *)guest_xsave->region, -sizeof (guest_xsave->region)); +kvm_vcpu_ioctl_x86_get_xsave2 (vcpu, (void *)guest_xsave->region, +sizeof (guest_xsave->region)); } static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,Quoted 1 line
base-commit:
86701e115030e020a052216baa942e8547e0b487Reviewed-by Maxim Levitsky <[email protected]>Best regards,
Maxim Levitsky
Sean Christopherson
maintainerQuoted 1 line · Like Xu
Emm, did we miss this little fix ?
No, I have it earmarked, it's just not a priority because it doesn't truly fix anything. Though I suppose it probably makes to apply it for 6.8, waiting one more day to send PULL requests to Paolo isn't a problem.
Sean Christopherson
maintainerQuoted 6 lines · Sean Christopherson
Quoted 1 line · Like Xu
Emm, did we miss this little fix ?
No, I have it earmarked, it's just not a priority because it doesn't truly fix anything. Though I suppose it probably makes to apply it for 6.8, waiting one more day to send PULL requests to Paolo isn't a problem.
Heh, when I tried to apply this I got reminded of why I held it for later. I want to apply it to kvm-x86/misc, but that's based on ~6.6-rc2 (plus a few KVM patches), i.e. doesn't have the "buggy" commit. I don't want to rebase "misc", nor do I want to create a branch and PULL request for a single trivial commit.
So for logistical reasons, I'm not going apply this right away, but I will make sure it gets into v6.7.
Quoted 8 lines · Sean Christopherson
Quoted 6 lines · Sean Christopherson
Quoted 1 line · Like Xu
Emm, did we miss this little fix ?
No, I have it earmarked, it's just not a priority because it doesn't truly fix anything. Though I suppose it probably makes to apply it for 6.8, waiting one more day to send PULL requests to Paolo isn't a problem.
Quoted 7 lines
Heh, when I tried to apply this I got reminded of why I held it for later. I want to apply it to kvm-x86/misc, but that's based on ~6.6-rc2 (plus a few KVM patches), i.e. doesn't have the "buggy" commit. I don't want to rebase "misc", nor do I want to create a branch and PULL request for a single trivial commit.
So for logistical reasons, I'm not going apply this right away, but I will make sure it gets into v6.7.
Thanks, and a similar pattern occurs with these functions:
'write_register_operand'
'account_shadowed'
'unaccount_shadowed'
'mtrr_lookup_fixed_next'
'pre_svm_run'
'svm_vcpu_deliver_sipi_vector'
Although the compiler will do the right thing, use 'return void' expression deliberately without grounds for exemption may annoy some CI pipelines.
If you need more cleanup or a new version to cover all these cases above, just let me know.
Sean Christopherson
maintainerQuoted 26 lines · Like Xu
Quoted 8 lines · Sean Christopherson
Quoted 6 lines · Sean Christopherson
Quoted 1 line · Like Xu
Emm, did we miss this little fix ?
No, I have it earmarked, it's just not a priority because it doesn't truly fix anything. Though I suppose it probably makes to apply it for 6.8, waiting one more day to send PULL requests to Paolo isn't a problem.
Quoted 7 lines
Heh, when I tried to apply this I got reminded of why I held it for later. I want to apply it to kvm-x86/misc, but that's based on ~6.6-rc2 (plus a few KVM patches), i.e. doesn't have the "buggy" commit. I don't want to rebase "misc", nor do I want to create a branch and PULL request for a single trivial commit.
So for logistical reasons, I'm not going apply this right away, but I will make sure it gets into v6.7.
Thanks, and a similar pattern occurs with these functions:
'
write_register_operand'
'account_shadowed'
'unaccount_shadowed'
'mtrr_lookup_fixed_next'
'pre_svm_run'
'svm_vcpu_deliver_sipi_vector'
Quoted 5 lines
Although the compiler will do the right thing, use 'return void' expression deliberately without grounds for exemption may annoy some CI pipelines.
If you need more cleanup or a new version to cover all these cases above, just let me know.
I'd rather update the CI pipelines to turn off -Wpedantic. There is zero chance that -Wpedantic will ever get enabled for kernel builds, the kernel is deliberately not ISO C compliant. I have no objection to cleaning up kvm_vcpu_ioctl_x86_get_xsave() because it's an obvious goof and a recent change, but like checkpatch warnings, I don't want to go around "fixing" warnings unless they are actively problematic for humans.
Quoted 6 lines · Like Xu
The requested info will be stored in '
guest_xsave->region' referenced by the incoming pointer "structkvm_xsave*guest_xsave", thus there is no need to explicitly use return void expression for a void function "static voidkvm_vcpu_ioctl_x86_get_xsave(...)". The issue is caught with [-Wpedantic].
Applied to kvm-x86 fixes, thanks!
[1/1] KVM: x86/xsave: Remove 'return void' expression for 'void function'
https://github.com/kvm-x86/linux/commit/ef8d89033c3f