netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fix kfifo_alloc() error check
@ 2006-11-22 18:33 Akinobu Mita
  2006-11-22 19:02 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Akinobu Mita @ 2006-11-22 18:33 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Stephen Hemminger

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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-23  4:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-22 18:33 [PATCH] net: fix kfifo_alloc() error check Akinobu Mita
2006-11-22 19:02 ` Stephen Hemminger
2006-11-23  4:35   ` David Miller

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).