]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: comedi: vmk80xx: zero buffers on allocation
authorIan Abbott <abbotti@mev.co.uk>
Thu, 14 Feb 2013 16:42:13 +0000 (16:42 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Feb 2013 18:17:55 +0000 (10:17 -0800)
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@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/vmk80xx.c

index eed46ee4f71023eac80410a39a02619b65731d77..78228f6a205644c7a064bee32576e291f5585650 100644 (file)
@@ -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;