From d49d0e39a09209d0136c7da2a1a52e99af2d4656 Mon Sep 17 00:00:00 2001 From: Kulikov Vasiliy Date: Fri, 30 Jul 2010 15:08:00 +0400 Subject: [PATCH] staging: otus: check kmalloc() return value kmalloc() may fail, if so return error from zfwUsbSubmitControl(). Signed-off-by: Kulikov Vasiliy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/otus/wrap_usb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/otus/wrap_usb.c b/drivers/staging/otus/wrap_usb.c index 93459cadc472..9f04047bf5a6 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, 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;