From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Date: Mon, 3 Jun 2013 02:08:13 +0000 (+0800)
Subject: staging/lustre: fix return value check in libcfs_sock_ioctl()
X-Git-Tag: firefly_0821_release~176^2~5845^2~325
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b3c1afd1fa366ef733a9f16c493a03396d7e4ab5;p=firefly-linux-kernel-4.4.55.git

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 <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

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