Skip to contentSkip to conversation

net: fix kfifo_alloc() error check

PATCH In review Akinobu Mita 3 participants 3 messages Nov 22, 2006 – Nov 23, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fix kfifo_alloc() error check

The return value of kfifo_alloc() should be checked by IS_ERR().

Cc Stephen Hemminger <[email protected]>
Cc David Miller <[email protected]>
---
 net/dccp/probe.c     |    2 ++
 net/ipv4/tcp_probe.c |    2 ++
 2 files changed, 4 insertions(+)
net/ipv4/tcp_probe.c +2 -0
Index: 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;
net/dccp/probe.c +2 -0
Index: 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;
#1 lore raw
Quoted 29 lines · On Thu, 23 Nov 2006 03:33:35 +0900 Akinobu Mita <[email protected]> wrote:

The return value of kfifo_alloc() should be checked by IS_ERR().

Cc Stephen Hemminger <[email protected]>
Cc David Miller <[email protected]>
---
 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
===================================================================

net/ipv4/tcp_probe.c +2 -0
@@ -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
===================================================================

net/dccp/probe.c static __init int dccpprobe_init(void) · line 167

Quoted 8 lines
net/dccp/probe.c +2 -0
@@ -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;

Good thanks

Signature · 1 line
Stephen Hemminger <[email protected]>
maintainer
#2 lore raw

From: Stephen Hemminger <[email protected]>
Date: Wed, 22 Nov 2006 11:02:46 -0800

Quoted 8 lines
Quoted 5 lines · On Thu, 23 Nov 2006 03:33:35 +0900 Akinobu Mita <[email protected]> wrote:

The return value of kfifo_alloc() should be checked by IS_ERR().

Cc Stephen Hemminger <[email protected]>
Cc David Miller <[email protected]>

...

Quoted 1 line

Good thanks

Looks good to me too, applied, thanks.