pengqianheng / rpms / kernel

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