浏览代码

USB: uas: Use kzalloc instead of kmalloc

The IUs are not being fully initialised by the driver (due to the reserved
space).  Since we should be zeroing reserved fields, use kzalloc to do
it for us.

Reported-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Matthew Wilcox 14 年之前
父节点
当前提交
ac563cfd52
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      drivers/usb/storage/uas.c

+ 2 - 2
drivers/usb/storage/uas.c

@@ -297,7 +297,7 @@ static struct urb *uas_alloc_sense_urb(struct uas_dev_info *devinfo, gfp_t gfp,
 	if (!urb)
 	if (!urb)
 		goto out;
 		goto out;
 
 
-	iu = kmalloc(sizeof(*iu), gfp);
+	iu = kzalloc(sizeof(*iu), gfp);
 	if (!iu)
 	if (!iu)
 		goto free;
 		goto free;
 
 
@@ -328,7 +328,7 @@ static struct urb *uas_alloc_cmd_urb(struct uas_dev_info *devinfo, gfp_t gfp,
 	if (len < 0)
 	if (len < 0)
 		len = 0;
 		len = 0;
 	len = ALIGN(len, 4);
 	len = ALIGN(len, 4);
-	iu = kmalloc(sizeof(*iu) + len, gfp);
+	iu = kzalloc(sizeof(*iu) + len, gfp);
 	if (!iu)
 	if (!iu)
 		goto free;
 		goto free;