Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1527759

[PATCH] [hv] storvsc: Payload buffer incorrectly sized for 32 bit kernels.

From Cathy Avery <cavery@redhat.com>
Newsgroups linux.kernel
Subject [PATCH] [hv] storvsc: Payload buffer incorrectly sized for 32 bit kernels.
Date 2016-11-22 18:40 +0100
Message-ID <sGnd1-1Py-59@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


On a 32 bit kernel sizeof(void *) is not 64 bits as hv_mpb_array
requires. Also the buffer needs to be cleared or the upper bytes
could contain junk.

Suggested-by: Vitaly Kuznets <vkuznets@redhat.com>
Signed-off-by: Cathy Avery <cavery@redhat.com>
---
 drivers/scsi/storvsc_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 8ccfc9e..b4a8c9d 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1495,11 +1495,12 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
 	if (sg_count) {
 		if (sg_count > MAX_PAGE_BUFFER_COUNT) {
 
-			payload_sz = (sg_count * sizeof(void *) +
+			payload_sz = (sg_count * sizeof(u64) +
 				      sizeof(struct vmbus_packet_mpb_array));
 			payload = kmalloc(payload_sz, GFP_ATOMIC);
 			if (!payload)
 				return SCSI_MLQUEUE_DEVICE_BUSY;
+			memset(payload, 0, payload_sz);
 		}
 
 		payload->range.len = length;
-- 
2.5.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] [hv] storvsc: Payload buffer incorrectly sized for 32 bit kernels. Cathy Avery <cavery@redhat.com> - 2016-11-22 18:40 +0100
  [PATCH] storvsc: fix kzalloc-simple.cocci warnings kbuild test robot <lkp@intel.com> - 2016-11-23 04:00 +0100
  Re: [PATCH] [hv] storvsc: Payload buffer incorrectly sized for 32  bit kernels. kbuild test robot <lkp@intel.com> - 2016-11-23 04:00 +0100

csiph-web