qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ioapic: remove useless lower bounds check
@ 2018-07-04 12:04 Paolo Bonzini
  2018-07-05  1:16 ` Peter Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2018-07-04 12:04 UTC (permalink / raw)
  To: qemu-devel

The vector cannot be negative.  Coverity now reports this because it sees an
array access before the check, in ioapic_stat_update_irq.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/intc/ioapic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
index b3937807c2..b6896ac4ce 100644
--- a/hw/intc/ioapic.c
+++ b/hw/intc/ioapic.c
@@ -152,7 +152,7 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
     if (vector == 0) {
         vector = 2;
     }
-    if (vector >= 0 && vector < IOAPIC_NUM_PINS) {
+    if (vector < IOAPIC_NUM_PINS) {
         uint32_t mask = 1 << vector;
         uint64_t entry = s->ioredtbl[vector];
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] ioapic: remove useless lower bounds check
  2018-07-04 12:04 [Qemu-devel] [PATCH] ioapic: remove useless lower bounds check Paolo Bonzini
@ 2018-07-05  1:16 ` Peter Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Xu @ 2018-07-05  1:16 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Wed, Jul 04, 2018 at 02:04:12PM +0200, Paolo Bonzini wrote:
> The vector cannot be negative.  Coverity now reports this because it sees an
> array access before the check, in ioapic_stat_update_irq.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Peter Xu <peterx@redhat.com>

Thanks!

-- 
Peter Xu

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-05  1:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-04 12:04 [Qemu-devel] [PATCH] ioapic: remove useless lower bounds check Paolo Bonzini
2018-07-05  1:16 ` Peter Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).