Skip to contentSkip to conversation

mptsas Coverity fixes

PATCH In review Paolo Bonzini 2 participants 5 messages Feb 16, 2016

lore
Share & tools
lore
#0 lore raw

cover mptsas Coverity fixes

Adding 3000 lines of code and not having Coverity complain would be quite an achievement. Three one-line fixes suffice, though.

Paolo

Paolo Bonzini (3):
mptsas: add missing va_end
mptsas: fix memory leak
mptsas: fix wrong formula

 hw/scsi/mptconfig.c | 1 +
 hw/scsi/mptsas.c    | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/3 mptsas: add missing va_end

Reported by Coverity.

---
 hw/scsi/mptconfig.c | 1 +
 1 file changed, 1 insertion(+)
hw/scsi/mptconfig.c +1 -0
index d049825..7071854 100644
@@ -123,6 +123,7 @@ static size_t vpack(uint8_t **p_data, const char *fmt, va_list ap1)
         va_copy(ap2, ap1);
         size = vfill(NULL, 0, fmt, ap2);
         *p_data = data = g_malloc(size);
+        va_end(ap2);
     }
     return vfill(data, size, fmt, ap1);
 }
Signature · 1 line
2.5.0
#2 lore raw

PATCH 2/3 mptsas: fix memory leak

In reply to Paolo Bonzini

Reported by Coverity.

---
 hw/scsi/mptsas.c | 1 +
 1 file changed, 1 insertion(+)
hw/scsi/mptsas.c +1 -0
index 333cc1f..1ce3226 100644
@@ -504,6 +504,7 @@ reply_maybe_async:
             reply_async->IOCLogInfo = count;
             return;
         }
+        g_free(reply_async);
         reply.TerminationCount = count;
         break;
 
Signature · 1 line
2.5.0
#3 lore raw

PATCH 3/3 mptsas: fix wrong formula

In reply to Paolo Bonzini

MPI_DOORBELL_WHO_INIT_SHIFT is being repeated twice. Reported by Coverity.

---
 hw/scsi/mptsas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/mptsas.c +1 -1
index 1ce3226..499c146 100644
@@ -824,7 +824,7 @@ static uint32_t mptsas_doorbell_read(MPTSASState *s)
 {
     uint32_t ret;
 
-    ret = (s->who_init << MPI_DOORBELL_WHO_INIT_SHIFT) & MPI_DOORBELL_WHO_INIT_SHIFT;
+    ret = (s->who_init << MPI_DOORBELL_WHO_INIT_SHIFT) & MPI_DOORBELL_WHO_INIT_MASK;
     ret |= s->state;
     switch (s->doorbell_state) {
     case DOORBELL_NONE:
Signature · 1 line
2.5.0