Whamcloud - gitweb
LU-4423 lnet: fix return value check in lnet_sock_ioctl() 25/15125/2
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Wed, 3 Jun 2015 17:29:56 +0000 (13:29 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 10 Jun 2015 03:24:08 +0000 (03:24 +0000)
Linux-commit: b3c1afd1fa366ef733a9f16c493a03396d7e4ab5

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>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: Ib1e04da4ab2d637a632f0b4e84f38ed6b114e27e
Reviewed-on: http://review.whamcloud.com/15125
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/lnet/lib-socket.c

index 0b6fc00..70b9ee2 100644 (file)
@@ -89,8 +89,8 @@ lnet_sock_ioctl(int cmd, unsigned long arg)
        sock_filp = sock_alloc_file(sock, 0);
 # endif
 #endif
-       if (!sock_filp) {
-               rc = -ENOMEM;
+       if (IS_ERR(sock_filp)) {
+               rc = PTR_ERR(sock_filp);
                sock_release(sock);
                goto out;
        }