diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-07-30 07:08:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-02 21:23:44 -0400 |
commit | d49d0e39a09209d0136c7da2a1a52e99af2d4656 (patch) | |
tree | ea4a0350a2739c3e05805a8d298321f3d7758a0b /drivers/staging | |
parent | 94f5659cfa4f14ba901fbbb8a57d0145754d0d37 (diff) |
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/otus/wrap_usb.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/staging/otus/wrap_usb.c b/drivers/staging/otus/wrap_usb.c index 93459cadc47..9f04047bf5a 100644 --- a/drivers/staging/otus/wrap_usb.c +++ b/drivers/staging/otus/wrap_usb.c | |||
@@ -104,6 +104,11 @@ u32_t zfwUsbSubmitControl(zdev_t *dev, u8_t req, u16_t value, u16_t index, | |||
104 | 104 | ||
105 | if (size > 0) { | 105 | if (size > 0) { |
106 | buf = kmalloc(size, GFP_KERNEL); | 106 | buf = kmalloc(size, GFP_KERNEL); |
107 | if (buf == NULL) { | ||
108 | pr_err("zfwUsbSubmitControl() failed, " | ||
109 | "kmalloc() returned NULL\n"); | ||
110 | return 1; | ||
111 | } | ||
107 | memcpy(buf, (u8_t *)data, size); | 112 | memcpy(buf, (u8_t *)data, size); |
108 | } else | 113 | } else |
109 | buf = NULL; | 114 | buf = NULL; |