From patchwork Tue Jun 1 09:25:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12290853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 886E1C4708F for ; Tue, 1 Jun 2021 09:26:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1273F61378 for ; Tue, 1 Jun 2021 09:26:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1273F61378 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8776F6B00A6; Tue, 1 Jun 2021 05:26:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84D626B00A8; Tue, 1 Jun 2021 05:26:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A2016B00A9; Tue, 1 Jun 2021 05:26:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id 378A06B00A6 for ; Tue, 1 Jun 2021 05:26:08 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C59C18249980 for ; Tue, 1 Jun 2021 09:26:07 +0000 (UTC) X-FDA: 78204623574.08.A3DA087 Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by imf19.hostedemail.com (Postfix) with ESMTP id C38109001E5E for ; Tue, 1 Jun 2021 09:25:52 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15199CmN126927; Tue, 1 Jun 2021 09:25:53 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-2020-01-29; bh=wwB4VSUvKdGzhu1xJP6jPOcXCgeh115bhoXsbDIkYts=; b=kUAZg7E56EW/JNy5ngfcQUNwrba4Vh/MJPSxBA2rKyLD1seXq+aBtZ3X44pLbndf+AeT 7CWbzXlRbwv0XjXL49uOnuS81piQBplQadsUEqwt7+eMJn8bI6YFAy0l9JO3P85niLYj PHUzuFDyscIZ6JNyQlItv9QpYKpPL5Z6BBULAmVkcKqzomrOmaxEj/xZx7KY7EUWPYX7 U5CIroogBen9b3zIWvulPKGjIdNZBCC3yQO4WRhVji57MOJc3tlFRlLEEfytBhFr4wvv 4161kAVZS2VRUEDMhLmAlHOm24ipXFQwrUc4Uo+49gfFw2kIN1pRHsdJOLK4HH1tsQTO Zg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 38ub4cmygw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Jun 2021 09:25:53 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1519AbLR057280; Tue, 1 Jun 2021 09:25:52 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3020.oracle.com with ESMTP id 38uycr45yd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Jun 2021 09:25:52 +0000 Received: from userp3020.oracle.com (userp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 1519NOV9084577; Tue, 1 Jun 2021 09:25:52 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 38uycr45xv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Jun 2021 09:25:52 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 1519Pp8o020050; Tue, 1 Jun 2021 09:25:51 GMT Received: from mwanda (/41.212.42.34) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 01 Jun 2021 09:25:50 +0000 Date: Tue, 1 Jun 2021 12:25:40 +0300 From: Dan Carpenter To: Mike Kravetz , Mina Almasry Cc: Andrew Morton , Stephen Rothwell , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] mm: hugetlb: checking for IS_ERR() instead of NULL Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Proofpoint-GUID: xyYXQHqPAUI61IN86pE8ylRfcFXBAwHi X-Proofpoint-ORIG-GUID: xyYXQHqPAUI61IN86pE8ylRfcFXBAwHi X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10001 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 clxscore=1011 impostorscore=0 adultscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106010062 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2020-01-29 header.b=kUAZg7E5; spf=none (imf19.hostedemail.com: domain of dan.carpenter@oracle.com has no SPF policy when checking 141.146.126.79) smtp.mailfrom=dan.carpenter@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: C38109001E5E X-Stat-Signature: 4acinnag9ahwhbd9mad7e8k9ibyjcmxs X-HE-Tag: 1622539552-953979 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The alloc_migrate_huge_page() doesn't return error pointers, it returns NULL. Fixes: ab45bc8b5910 ("mm, hugetlb: fix resv_huge_pages underflow on UFFDIO_COPY") Signed-off-by: Dan Carpenter Reviewed-by: Mina Almasry --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 69a4b551c157..3221c94b4749 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5103,7 +5103,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, */ page = alloc_migrate_huge_page(h, gfp_mask, node, nodemask); - if (IS_ERR(page)) { + if (!page) { ret = -ENOMEM; goto out; }