From patchwork Thu May 31 06:21:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10440365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 902EA602BF for ; Thu, 31 May 2018 06:21:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F46A2912A for ; Thu, 31 May 2018 06:21:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73AAA2913D; Thu, 31 May 2018 06:21:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E23492912A for ; Thu, 31 May 2018 06:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753960AbeEaGVg (ORCPT ); Thu, 31 May 2018 02:21:36 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:49274 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751037AbeEaGVd (ORCPT ); Thu, 31 May 2018 02:21:33 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4V6Fv64176984; Thu, 31 May 2018 06:21:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=Qv8CHadxmkOiWQ3oC5PIq3ldsnzmuwCHC/QxrqRTt4c=; b=BeemRuuXAARnaIbBxUJIvLxYdGBxzpaVnUrZk5nIvEY9ZF9HzZE50ZgncZY/VQGd9Diq 90QfO3RPR2fS4FZMajb6w+/hsbyBnsoz0CI61fxsMWhjo8jtVLjf68+7848Up4VIhBXk vcLUsWVaqzpKudk5vR08BI5Tnaqevk0Kk9L72OaL1bqEwKd0OJXeipBNXDm8qJMR4Ll/ smbpMzjd4abi3ZGjn34afAl0qatlXj0eXrSrMGvVNyoGUZHz9XsJ5ORX1vkKkX+cc16r GN5Oi7U6d6TAnzplm2kRpoBpIap9DdShe13L3FdSAoDamVp0y008sxtNwDujZjWw06T4 4w== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2j9x4hadw7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 May 2018 06:21:26 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w4V6LP0Q025055 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 May 2018 06:21:25 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w4V6LPlA009453; Thu, 31 May 2018 06:21:25 GMT Received: from kili.mountain (/197.157.0.20) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 30 May 2018 23:21:24 -0700 Date: Thu, 31 May 2018 09:21:11 +0300 From: Dan Carpenter To: Chris Mason , Tomohiro Misono Cc: Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] Btrfs: checking for NULL instead of IS_ERR Message-ID: <20180531062111.374pq6lxrmdffun6@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8909 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=904 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1805310071 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP memdup_user() returns error pointers, it doesn't return NULL. Fixes: 01141b08dee5 ("btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF") Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ff5018587bd9..d8dd4504bdab 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2791,9 +2791,9 @@ static noinline int btrfs_ioctl_get_subvol_rootref(struct file *file, return -ENOMEM; rootrefs = memdup_user(argp, sizeof(*rootrefs)); - if (!rootrefs) { + if (IS_ERR(rootrefs)) { btrfs_free_path(path); - return -ENOMEM; + return PTR_ERR(rootrefs); } inode = file_inode(file);