Commit 4585ef11 authored by Julia Lawall's avatar Julia Lawall Committed by Greg Kroah-Hartman

USB: FHCI: Correct the size argument to kzalloc

urb_priv->tds has type struct td **, not struct td *, so the
elements of the array should have pointer type, not structure type.

Convert kzalloc to kcalloc as well.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@disable sizeof_type_expr@
type T;
T **x;
@@

  x =
  <+...sizeof(
- T
+ *x
  )...+>
// </smpl>
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0f2c2d7b
...@@ -433,7 +433,7 @@ static int fhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -433,7 +433,7 @@ static int fhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
return -ENOMEM; return -ENOMEM;
/* allocate the private part of the URB */ /* allocate the private part of the URB */
urb_priv->tds = kzalloc(size * sizeof(struct td), mem_flags); urb_priv->tds = kcalloc(size, sizeof(*urb_priv->tds), mem_flags);
if (!urb_priv->tds) { if (!urb_priv->tds) {
kfree(urb_priv); kfree(urb_priv);
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment