staging: otus: check kmalloc() return value

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>
This commit is contained in:
Kulikov Vasiliy 2010-07-30 15:08:00 +04:00 committed by Greg Kroah-Hartman
parent 94f5659cfa
commit d49d0e39a0
1 changed files with 5 additions and 0 deletions

View File

@ -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;