diff mbox

KVM: x86: silence GCC warning on memset ioapic->irq_eoi

Message ID 1462210453-27907-1-git-send-email-rkrcmar@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Radim Krčmář May 2, 2016, 5:34 p.m. UTC
New GCC notices a mistake,
  arch/x86/kvm/ioapic.c:595:2: warning: ‘memset’ used with length equal
  to number of elements without multiplication by element size
  [-Wmemset-elt-size]

that has no effect on execution, because we zero a zeroed array.
Preserve the useless memset as kvm_ioapic_reset() wants to be generic.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com>
---
 arch/x86/kvm/ioapic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Bonzini May 9, 2016, 1:02 p.m. UTC | #1
On 02/05/2016 19:34, Radim Kr?má? wrote:
> New GCC notices a mistake,
>   arch/x86/kvm/ioapic.c:595:2: warning: ‘memset’ used with length equal
>   to number of elements without multiplication by element size
>   [-Wmemset-elt-size]
> 
> that has no effect on execution, because we zero a zeroed array.
> Preserve the useless memset as kvm_ioapic_reset() wants to be generic.
> 
> Reported-by: David Binderman <dcb314@hotmail.com>
> Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com>
> ---
>  arch/x86/kvm/ioapic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
> index 9db47090ead0..4861e6e622a3 100644
> --- a/arch/x86/kvm/ioapic.c
> +++ b/arch/x86/kvm/ioapic.c
> @@ -592,7 +592,7 @@ static void kvm_ioapic_reset(struct kvm_ioapic *ioapic)
>  	ioapic->irr = 0;
>  	ioapic->irr_delivered = 0;
>  	ioapic->id = 0;
> -	memset(ioapic->irq_eoi, 0x00, IOAPIC_NUM_PINS);
> +	memset(ioapic->irq_eoi, 0x00, sizeof(ioapic->irq_eoi));
>  	rtc_irq_eoi_tracking_reset(ioapic);
>  }
>  
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
index 9db47090ead0..4861e6e622a3 100644
--- a/arch/x86/kvm/ioapic.c
+++ b/arch/x86/kvm/ioapic.c
@@ -592,7 +592,7 @@  static void kvm_ioapic_reset(struct kvm_ioapic *ioapic)
 	ioapic->irr = 0;
 	ioapic->irr_delivered = 0;
 	ioapic->id = 0;
-	memset(ioapic->irq_eoi, 0x00, IOAPIC_NUM_PINS);
+	memset(ioapic->irq_eoi, 0x00, sizeof(ioapic->irq_eoi));
 	rtc_irq_eoi_tracking_reset(ioapic);
 }