From: Akinobu Mita <akinobu.mita@gmail.com>
To: netdev@vger.kernel.org
Cc: David Miller <davem@davemloft.net>,
Stephen Hemminger <shemminger@osdl.org>
Subject: [PATCH] net: fix kfifo_alloc() error check
Date: Thu, 23 Nov 2006 03:33:35 +0900 [thread overview]
Message-ID: <20061122183335.GA2985@APFDCB5C> (raw)
The return value of kfifo_alloc() should be checked by IS_ERR().
Cc: Stephen Hemminger <shemminger@osdl.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
net/dccp/probe.c | 2 ++
net/ipv4/tcp_probe.c | 2 ++
2 files changed, 4 insertions(+)
Index: work-fault-inject/net/ipv4/tcp_probe.c
===================================================================
--- work-fault-inject.orig/net/ipv4/tcp_probe.c
+++ work-fault-inject/net/ipv4/tcp_probe.c
@@ -156,6 +156,8 @@ static __init int tcpprobe_init(void)
init_waitqueue_head(&tcpw.wait);
spin_lock_init(&tcpw.lock);
tcpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &tcpw.lock);
+ if (IS_ERR(tcpw.fifo))
+ return PTR_ERR(tcpw.fifo);
if (!proc_net_fops_create(procname, S_IRUSR, &tcpprobe_fops))
goto err0;
Index: work-fault-inject/net/dccp/probe.c
===================================================================
--- work-fault-inject.orig/net/dccp/probe.c
+++ work-fault-inject/net/dccp/probe.c
@@ -160,6 +160,8 @@ static __init int dccpprobe_init(void)
init_waitqueue_head(&dccpw.wait);
spin_lock_init(&dccpw.lock);
dccpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &dccpw.lock);
+ if (IS_ERR(dccpw.fifo))
+ return PTR_ERR(dccpw.fifo);
if (!proc_net_fops_create(procname, S_IRUSR, &dccpprobe_fops))
goto err0;
next reply other threads:[~2006-11-22 18:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-22 18:33 Akinobu Mita [this message]
2006-11-22 19:02 ` [PATCH] net: fix kfifo_alloc() error check Stephen Hemminger
2006-11-23 4:35 ` 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=20061122183335.GA2985@APFDCB5C \
--to=akinobu.mita@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@osdl.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).