[PATCH 1/4] staging: comedi: vmk80xx: zero buffers on allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Zero out `devpriv->usb_tx_buf` and `devpriv->usb_rx_buf` on allocation.
When sending data to the USB device, this ensures any unused part of the
buffer will not contain random crap.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
 drivers/staging/comedi/drivers/vmk80xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index ebf2d48..0a74e6c 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -997,12 +997,12 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev)
 	size_t size;
 
 	size = le16_to_cpu(devpriv->ep_rx->wMaxPacketSize);
-	devpriv->usb_rx_buf = kmalloc(size, GFP_KERNEL);
+	devpriv->usb_rx_buf = kzalloc(size, GFP_KERNEL);
 	if (!devpriv->usb_rx_buf)
 		return -ENOMEM;
 
 	size = le16_to_cpu(devpriv->ep_tx->wMaxPacketSize);
-	devpriv->usb_tx_buf = kmalloc(size, GFP_KERNEL);
+	devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
 	if (!devpriv->usb_tx_buf) {
 		kfree(devpriv->usb_rx_buf);
 		return -ENOMEM;
-- 
1.8.1.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux