From patchwork Fri Dec 11 10:13:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11967851 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=-15.8 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 42D21C433FE for ; Fri, 11 Dec 2020 10:14:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A6E4923C82 for ; Fri, 11 Dec 2020 10:14:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6E4923C82 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 CE39D6B0036; Fri, 11 Dec 2020 05:14:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C92B16B005D; Fri, 11 Dec 2020 05:14:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B803E6B0068; Fri, 11 Dec 2020 05:14:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id A1C106B0036 for ; Fri, 11 Dec 2020 05:14:11 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 644DC3623 for ; Fri, 11 Dec 2020 10:14:11 +0000 (UTC) X-FDA: 77580591102.04.ice46_32124e627400 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 459B8800B288 for ; Fri, 11 Dec 2020 10:14:11 +0000 (UTC) X-HE-Tag: ice46_32124e627400 X-Filterd-Recvd-Size: 3965 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Fri, 11 Dec 2020 10:14:10 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BBA9WVM134936; Fri, 11 Dec 2020 10:14:07 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=FNgcbvekq0t3JHkWHIlt7bqpEDwnJ3novWxxvB9389I=; b=HnbFQOZR2v4EckWDVxevE0HtAruS5UxnYG7a3wzvRt6oR9uCTVSiF0dGyt3X3VtVCSBQ iBRu7mYlc8w1V9r6XXyAhEoPZpyZtYnThatyBVv8BHRJcNk4LBhsjNSMscrQstbYeQTj hfqfeXiUPUraQQdNcM5Dci9mb5arzRY+H9iwqTz28ElIN0UHrSjk16bRg+JA9EOfmCfj xgtCFauigM+4WImOZ+yVXRODLMndD0+NpQlhVJOGl2T4JoS4MRhjaQkFw+BD7xmoT2d+ KOWCCHN0Yw6mRqiQNdtA9cjqb2qIu8bZVIirCRRAOo0hCPweK4SZ1y/bc7ftHQJL4u/U ZQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 35825mhx29-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 11 Dec 2020 10:14:07 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BBA9rBN083963; Fri, 11 Dec 2020 10:14:06 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 358m53n8ra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Dec 2020 10:14:06 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0BBAE5xW012966; Fri, 11 Dec 2020 10:14:05 GMT Received: from mwanda (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 11 Dec 2020 02:14:05 -0800 Date: Fri, 11 Dec 2020 13:13:57 +0300 From: Dan Carpenter To: Mike Kravetz , Mina Almasry Cc: Andrew Morton , David Rientjes , linux-mm@kvack.org, kernel-janitors@vger.kernel.org Subject: [PATCH] hugetlb: Fix an error code in hugetlb_reserve_pages() Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9831 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012110062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9831 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 clxscore=1011 priorityscore=1501 mlxscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012110062 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: Preserve the error code from region_add() instead of returning success. Fixes: 0db9d74ed884 ("hugetlb: disable region_add file_region coalescing") Signed-off-by: Dan Carpenter Reviewed-by: David Hildenbrand Reviewed-by: Mike Kravetz --- From static analysis. Untested. mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 1f3bf1710b66..ac2e48b9f1d7 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5113,6 +5113,7 @@ int hugetlb_reserve_pages(struct inode *inode, if (unlikely(add < 0)) { hugetlb_acct_memory(h, -gbl_reserve); + ret = add; goto out_put_pages; } else if (unlikely(chg > add)) { /*