chengshan / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
e293be
centosplus kernel patch [bug#12841]
e293be
e293be
commit b0120d9906253570f593daf82016a5331bbee2b8
e293be
Author: Cathy Avery <cavery@redhat.com>
e293be
Date:   Wed Nov 23 08:46:33 2016 -0500
e293be
e293be
    scsi: storvsc: Payload buffer incorrectly sized for 32 bit kernels.
e293be
    
e293be
    On a 32 bit kernel sizeof(void *) is not 64 bits as hv_mpb_array
e293be
    requires. Also the buffer needs to be cleared or the upper bytes will
e293be
    contain junk.
e293be
    
e293be
    Suggested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
e293be
    Signed-off-by: Cathy Avery <cavery@redhat.com>
e293be
    Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
e293be
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
e293be
e293be
    Applied-by: Akemi Yagi <toracat@centos.org>
e293be
e293be
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
e293be
index 8ccfc9e..05526b7 100644
e293be
--- a/drivers/scsi/storvsc_drv.c
e293be
+++ b/drivers/scsi/storvsc_drv.c
e293be
@@ -1495,9 +1495,9 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
e293be
 	if (sg_count) {
e293be
 		if (sg_count > MAX_PAGE_BUFFER_COUNT) {
e293be
 
e293be
-			payload_sz = (sg_count * sizeof(void *) +
e293be
+			payload_sz = (sg_count * sizeof(u64) +
e293be
 				      sizeof(struct vmbus_packet_mpb_array));
e293be
-			payload = kmalloc(payload_sz, GFP_ATOMIC);
e293be
+			payload = kzalloc(payload_sz, GFP_ATOMIC);
e293be
 			if (!payload)
e293be
 				return SCSI_MLQUEUE_DEVICE_BUSY;
e293be
 		}