Commit ac16ca64 authored by Akinobu Mita's avatar Akinobu Mita Committed by David S. Miller

[NET]: Fix kfifo_alloc() error check.

The return value of kfifo_alloc() should be checked by IS_ERR().
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 753eab76
...@@ -160,6 +160,8 @@ static __init int dccpprobe_init(void) ...@@ -160,6 +160,8 @@ static __init int dccpprobe_init(void)
init_waitqueue_head(&dccpw.wait); init_waitqueue_head(&dccpw.wait);
spin_lock_init(&dccpw.lock); spin_lock_init(&dccpw.lock);
dccpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &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)) if (!proc_net_fops_create(procname, S_IRUSR, &dccpprobe_fops))
goto err0; goto err0;
......
...@@ -156,6 +156,8 @@ static __init int tcpprobe_init(void) ...@@ -156,6 +156,8 @@ static __init int tcpprobe_init(void)
init_waitqueue_head(&tcpw.wait); init_waitqueue_head(&tcpw.wait);
spin_lock_init(&tcpw.lock); spin_lock_init(&tcpw.lock);
tcpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &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)) if (!proc_net_fops_create(procname, S_IRUSR, &tcpprobe_fops))
goto err0; goto err0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment