linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Choudhary <amit2030@gmail.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] net/wanrouter/wanmain.c: check kmalloc() return value.
Date: Thu, 8 Mar 2007 23:26:54 -0800	[thread overview]
Message-ID: <20070308232654.d0334ccd.amit2030@gmail.com> (raw)

Description: Check the return value of kmalloc() in function dbg_kmalloc(), in file net/wanrouter/wanmain.c.

Signed-off-by: Amit Choudhary <amit2030@gmail.com>

diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 316211d..263450c 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -67,6 +67,8 @@ static void * dbg_kmalloc(unsigned int s
 	int i = 0;
 	void * v = kmalloc(size+sizeof(unsigned int)+2*KMEM_SAFETYZONE*8,prio);
 	char * c1 = v;
+	if (!v)
+		return NULL;
 	c1 += sizeof(unsigned int);
 	*((unsigned int *)v) = size;
 

             reply	other threads:[~2007-03-09  7:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-09  7:26 Amit Choudhary [this message]
2007-03-09  7:31 ` [PATCH] net/wanrouter/wanmain.c: check kmalloc() return value David Miller

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=20070308232654.d0334ccd.amit2030@gmail.com \
    --to=amit2030@gmail.com \
    --cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).