Blame 0005-scsi-initialise-info-object-with-appropriate-size.patch

b24b7f
From: P J P <ppandit@redhat.com>
b24b7f
Date: Mon, 21 Dec 2015 15:13:13 +0530
b24b7f
Subject: [PATCH] scsi: initialise info object with appropriate size
b24b7f
b24b7f
While processing controller 'CTRL_GET_INFO' command, the routine
b24b7f
'megasas_ctrl_get_info' overflows the '&info' object size. Use its
b24b7f
appropriate size to null initialise it.
b24b7f
b24b7f
Reported-by: Qinghao Tang <luodalongde@gmail.com>
b24b7f
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
b24b7f
Message-Id: <alpine.LFD.2.20.1512211501420.22471@wniryva>
b24b7f
Cc: qemu-stable@nongnu.org
b24b7f
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
b24b7f
Signed-off-by: P J P <ppandit@redhat.com>
b24b7f
(cherry picked from commit 36fef36b91f7ec0435215860f1458b5342ce2811)
b24b7f
---
b24b7f
 hw/scsi/megasas.c | 2 +-
b24b7f
 1 file changed, 1 insertion(+), 1 deletion(-)
b24b7f
b24b7f
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
b24b7f
index d7dc667..576f56c 100644
b24b7f
--- a/hw/scsi/megasas.c
b24b7f
+++ b/hw/scsi/megasas.c
b24b7f
@@ -718,7 +718,7 @@ static int megasas_ctrl_get_info(MegasasState *s, MegasasCmd *cmd)
b24b7f
     BusChild *kid;
b24b7f
     int num_pd_disks = 0;
b24b7f
 
b24b7f
-    memset(&info, 0x0, cmd->iov_size);
b24b7f
+    memset(&info, 0x0, dcmd_size);
b24b7f
     if (cmd->iov_size < dcmd_size) {
b24b7f
         trace_megasas_dcmd_invalid_xfer_len(cmd->index, cmd->iov_size,
b24b7f
                                             dcmd_size);