[NET]: Fix kfifo_alloc() error check.
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 23 Nov 2006 04:26:11 +0000 (20:26 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sat, 25 Nov 2006 23:16:49 +0000 (15:16 -0800)
The return value of kfifo_alloc() should be checked by IS_ERR().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dccp/probe.c
net/ipv4/tcp_probe.c

index 146496fce2e2b4c6e40389ecbafc41b6a302ae97..fded1493c1dcc8a01884407b8f34d4b6a7834c98 100644 (file)
@@ -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;
index 4be336f17883ca21e129fd93a146d6e73c338fb1..f230eeecf09289eaabcb6125af5129ae0fb57cc0 100644 (file)
@@ -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;