Skip to contentSkip to conversation

KVM: mmu: Remove unused local variable

PATCH In review Jan Kiszka 4 participants 6 messages Jun 3, 2010 – Jun 6, 2010

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 KVM: mmu: Remove unused local variable

From: Jan Kiszka <[email protected]>

---

No one else checks for new build warnings?

 arch/x86/kvm/mmu.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
arch/x86/kvm/mmu.c +0 -1
index c16c4ca..9b9d773 100644
@@ -2045,7 +2045,6 @@ static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn)
 {
 	char buf[1];
 	void __user *hva;
-	int r;
 
 	/* Touch the page, so send SIGBUS */
 	hva = (void __user *)gfn_to_hva(kvm, gfn);
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 15 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

---

No one else checks for new build warnings?

 arch/x86/kvm/mmu.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
arch/x86/kvm/mmu.c +0 -0
index c16c4ca..9b9d773 100644

arch/x86/kvm/mmu.c static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn) · line 2048

Quoted 5 lines
arch/x86/kvm/mmu.c +0 -1
@@ -2045,7 +2045,6 @@ static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn)
 {
 	char buf[1];
 	void __user *hva;
-	int r;
 

Actually, the compiler still complain:

arch/x86/kvm/mmu.c: In function ‘kvm_send_hwpoison_signal’:
arch/x86/kvm/mmu.c:2051: warning: ignoring return value of ‘copy_from_user’, declared with attribute warn_unused_resul

Maybe we can fix it like this:

---
 arch/x86/kvm/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/mmu.c +1 -1
index c16c4ca..a62e3ba 100644
@@ -2049,7 +2049,7 @@ static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn)
 
 	/* Touch the page, so send SIGBUS */
 	hva = (void __user *)gfn_to_hva(kvm, gfn);
-	(void)copy_from_user(buf, hva, 1);
+	r = copy_from_user(buf, hva, 1);
 }
 
 static int kvm_handle_bad_page(struct kvm *kvm, gfn_t gfn, pfn_t pfn)
Signature · 1 line
1.6.1.2
author
#2 lore raw
Quoted 25 lines · Xiao Guangrong
Quoted 15 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

---

No one else checks for new build warnings?

 arch/x86/kvm/mmu.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
arch/x86/kvm/mmu.c +0 -0
index c16c4ca..9b9d773 100644

arch/x86/kvm/mmu.c static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn) · line 2048

Quoted 5 lines
arch/x86/kvm/mmu.c +0 -1
@@ -2045,7 +2045,6 @@ static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn)
 {
 	char buf[1];
 	void __user *hva;
-	int r;
 

Actually, the compiler still complain:

Quoted 2 lines

arch/x86/kvm/mmu.c: In function ‘kvm_send_hwpoison_signal’:
arch/x86/kvm/mmu.c:2051: warning: ignoring return value of ‘copy_from_user’, declared with attribute warn_unused_resul

Indeed. I only looked at the log from older kernels.

Quoted 13 lines

Maybe we can fix it like this:

---
 arch/x86/kvm/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/mmu.c +0 -0
index c16c4ca..a62e3ba 100644

arch/x86/kvm/mmu.c static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn) · line 2055

Quoted 8 lines
arch/x86/kvm/mmu.c +1 -1
@@ -2049,7 +2049,7 @@ static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn)
 
 	/* Touch the page, so send SIGBUS */
 	hva = (void __user *)gfn_to_hva(kvm, gfn);
-	(void)copy_from_user(buf, hva, 1);
+	r = copy_from_user(buf, hva, 1);
 }
 
 static int kvm_handle_bad_page(struct kvm *kvm, gfn_t gfn, pfn_t pfn)

Probably this was the original plan (CC'ing the author).

Jan

#3 lore raw

PATCH RESEND 1/1 KVM: MMU: fix compile warning in kvm_send_hwpoison_signal()

In reply to Xiao Guangrong

fix:

arch/x86/kvm/mmu.c: In function ‘kvm_send_hwpoison_signal’:
arch/x86/kvm/mmu.c:2051: warning: ignoring return value of ‘copy_from_user’, declared with attribute warn_unused_resul

---
 arch/x86/kvm/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/mmu.c +1 -1
index c16c4ca..a62e3ba 100644
@@ -2049,7 +2049,7 @@ static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn)
 
 	/* Touch the page, so send SIGBUS */
 	hva = (void __user *)gfn_to_hva(kvm, gfn);
-	(void)copy_from_user(buf, hva, 1);
+	r = copy_from_user(buf, hva, 1);
 }
 
 static int kvm_handle_bad_page(struct kvm *kvm, gfn_t gfn, pfn_t pfn)
Signature · 1 line
1.6.1.2
#4 lore raw

Re: [PATCH resend] KVM: MMU: fix compile warning in kvm_send_hwpoison_signal()

Quoted 10 lines · Xiao Guangrong

fix:

arch/x86/kvm/mmu.c: In function ‘kvm_send_hwpoison_signal’:
arch/x86/kvm/mmu.c:2051: warning: ignoring return value of ‘copy_from_user’, declared with attribute warn_unused_resul

---
 arch/x86/kvm/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.