Skip to content

Commit

Permalink
staging: otus: check kmalloc() return value
Browse files Browse the repository at this point in the history
kmalloc() may fail, if so return error from zfwUsbSubmitControl().

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Kulikov Vasiliy authored and Greg Kroah-Hartman committed Aug 3, 2010
1 parent 94f5659 commit d49d0e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/staging/otus/wrap_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ u32_t zfwUsbSubmitControl(zdev_t *dev, u8_t req, u16_t value, u16_t index,

if (size > 0) {
buf = kmalloc(size, GFP_KERNEL);
if (buf == NULL) {
pr_err("zfwUsbSubmitControl() failed, "
"kmalloc() returned NULL\n");
return 1;
}
memcpy(buf, (u8_t *)data, size);
} else
buf = NULL;
Expand Down

0 comments on commit d49d0e3

Please sign in to comment.