From: Ian Abbott Date: Thu, 14 Feb 2013 16:42:13 +0000 (+0000) Subject: staging: comedi: vmk80xx: zero buffers on allocation X-Git-Tag: firefly_0821_release~3680^2~1080^2~40 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0cbfc8269b980adafa7b529bb529a2fc316c5405;p=firefly-linux-kernel-4.4.55.git staging: comedi: vmk80xx: zero buffers on allocation 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index eed46ee4f710..78228f6a2056 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -994,12 +994,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;