Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756733Ab3FCCIU (ORCPT ); Sun, 2 Jun 2013 22:08:20 -0400 Received: from mail-bk0-f50.google.com ([209.85.214.50]:32860 "EHLO mail-bk0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755945Ab3FCCIO (ORCPT ); Sun, 2 Jun 2013 22:08:14 -0400 MIME-Version: 1.0 Date: Mon, 3 Jun 2013 10:08:13 +0800 Message-ID: Subject: [PATCH -next] staging/lustre: fix return value check in libcfs_sock_ioctl() From: Wei Yongjun To: gregkh@linuxfoundation.org, andreas.dilger@intel.com, tao.peng@emc.com Cc: yongjun_wei@trendmicro.com.cn, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1198 Lines: 35 From: Wei Yongjun 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 --- no compile test --- 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 6f1f047..855c7e8 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; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/