public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Kulikov Vasiliy <segooon@gmail.com>
Cc: kernel-janitors@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Alexander Beregalov <a.beregalov@gmail.com>,
	Tejun Heo <tj@kernel.org>,
	Mithlesh Thukral <mithlesh@linsyssoft.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/9] staging: otus: check kmalloc() return value
Date: Fri, 30 Jul 2010 14:31:16 +0200	[thread overview]
Message-ID: <4C52C614.4030803@bfs.de> (raw)
In-Reply-To: <1280488080-20777-1-git-send-email-segooon@gmail.com>



Kulikov Vasiliy schrieb:
> kmalloc() may fail, if so return error from zfwUsbSubmitControl().
> 
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
> ---
>  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 93459ca..9f04047 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;


We had a memdup() somewhere had'nt we ?

re,
 wh

  reply	other threads:[~2010-07-30 12:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-30 11:08 [PATCH 3/9] staging: otus: check kmalloc() return value Kulikov Vasiliy
2010-07-30 12:31 ` walter harms [this message]
2010-07-30 12:49   ` Jiri Slaby
2010-07-30 14:07 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C52C614.4030803@bfs.de \
    --to=wharms@bfs.de \
    --cc=a.beregalov@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mithlesh@linsyssoft.com \
    --cc=segooon@gmail.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox