Skip to content

Commit

Permalink
USB: uas: Use kzalloc instead of kmalloc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthew Wilcox authored and Greg Kroah-Hartman committed Dec 15, 2010
1 parent 4400ef3 commit ac563cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/storage/uas.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static struct urb *uas_alloc_sense_urb(struct uas_dev_info *devinfo, gfp_t gfp,
if (!urb)
goto out;

iu = kmalloc(sizeof(*iu), gfp);
iu = kzalloc(sizeof(*iu), gfp);
if (!iu)
goto free;

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

Expand Down

0 comments on commit ac563cf

Please sign in to comment.