Skip to contentSkip to conversation

KVM: SEV: Fix unused variable in guest request handling

PATCH In review Michael Roth 3 participants 5 messages May 13, 2024 – May 20, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: SEV: Fix unused variable in guest request handling

The variable 'sev' is assigned, but never used. Remove it.

Fixes 449ead2d1edb ("KVM: SEV: Provide support for SNP_GUEST_REQUEST NAE event")
---
 arch/x86/kvm/svm/sev.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kvm/svm/sev.c +0 -3
index 59c0d89a4d52..6cf665c410b2 100644
@@ -3965,14 +3965,11 @@ static int __snp_handle_guest_req(struct kvm *kvm, gpa_t req_gpa, gpa_t resp_gpa
 				  sev_ret_code *fw_err)
 {
 	struct sev_data_snp_guest_request data = {0};
-	struct kvm_sev_info *sev;
 	int ret;
 
 	if (!sev_snp_guest(kvm))
 		return -EINVAL;
 
-	sev = &to_kvm_svm(kvm)->sev_info;
-
 	ret = snp_setup_guest_buf(kvm, &data, req_gpa, resp_gpa);
 	if (ret)
 		return ret;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Michael Roth

The variable 'sev' is assigned, but never used. Remove it.

Fixes 449ead2d1edb ("KVM: SEV: Provide support for SNP_GUEST_REQUEST NAE event")
Quoted 23 lines
---
 arch/x86/kvm/svm/sev.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kvm/svm/sev.c +0 -3
index 59c0d89a4d52..6cf665c410b2 100644
@@ -3965,14 +3965,11 @@ static int __snp_handle_guest_req(struct kvm *kvm, gpa_t req_gpa, gpa_t resp_gpa
 				  sev_ret_code *fw_err)
 {
 	struct sev_data_snp_guest_request data = {0};
-	struct kvm_sev_info *sev;
 	int ret;
 
 	if (!sev_snp_guest(kvm))
 		return -EINVAL;
 
-	sev = &to_kvm_svm(kvm)->sev_info;
-
 	ret = snp_setup_guest_buf(kvm, &data, req_gpa, resp_gpa);
 	if (ret)
 		return ret;
#2 lore raw
In reply to Michael Roth
Quoted 1 line

The variable 'sev' is assigned, but never used. Remove it.

Would it be a bit nicer to use the word “Omit” instead of “Fix” in the summary phrase?

Regards,
Markus

#3 lore raw

Hey Markus,

Quoted 3 lines · Markus Elfring
Quoted 1 line

The variable 'sev' is assigned, but never used. Remove it.

Would it be a bit nicer to use the word “Omit” instead of “Fix” in the summary phrase?

I can find many instances of "Fix unused variable" in the history of the kernel:

ubsan: fix unused variable warning in test module x86/resctrl: Fix unused variable warning in cache_alloc_hsw_probe()
octeontx2-pf: Fix unused variable build error
etc...

but not a single "Omit unused variable" commit.

Quoted 3 lines

Regards,
Markus

Thanks,
Carlos

#4 lore raw
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

The variable 'sev' is assigned, but never used. Remove it.

Would it be a bit nicer to use the word “Omit” instead of “Fix” in the summary phrase?

I can find many instances of "Fix unused variable" in the history of the kernel:

…

Quoted 1 line

but not a single "Omit unused variable" commit.

Some implementation details were fixed somehow because of a warning or error message. You would probably like to point the desire out in your summary phrase to get rid of another bit of redundant source code.

Were any analysis tools involved in the discovery of corresponding change possibilities?

Regards,
Markus