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

* Re: [PATCH] net: fix kfifo_alloc() error check
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2006-11-22 19:02 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: netdev, David Miller

On Thu, 23 Nov 2006 03:33:35 +0900
Akinobu Mita <akinobu.mita@gmail.com> wrote:

> 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;

Good thanks

-- 
Stephen Hemminger <shemminger@osdl.org>

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

* Re: [PATCH] net: fix kfifo_alloc() error check
  2006-11-22 19:02 ` Stephen Hemminger
@ 2006-11-23  4:35   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2006-11-23  4:35 UTC (permalink / raw)
  To: shemminger; +Cc: akinobu.mita, netdev

From: Stephen Hemminger <shemminger@osdl.org>
Date: Wed, 22 Nov 2006 11:02:46 -0800

> On Thu, 23 Nov 2006 03:33:35 +0900
> Akinobu Mita <akinobu.mita@gmail.com> wrote:
> 
> > 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>
 ...
> Good thanks

Looks good to me too, applied, thanks.

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