From b3c1afd1fa366ef733a9f16c493a03396d7e4ab5 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Mon, 3 Jun 2013 10:08:13 +0800 Subject: [PATCH] staging/lustre: fix return value check in libcfs_sock_ioctl() In case of error, the function sock_alloc_file() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c index 6f1f047d6555..855c7e87d96f 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c @@ -59,9 +59,9 @@ libcfs_sock_ioctl(int cmd, unsigned long arg) } sock_filp = sock_alloc_file(sock, 0, NULL); - if (!sock_filp) { + if (IS_ERR(sock_filp)) { sock_release(sock); - rc = -ENOMEM; + rc = PTR_ERR(sock_filp); goto out; }