From patchwork Wed May 13 09:42:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11545551 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE11D913 for ; Wed, 13 May 2020 09:44:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7B12E20740 for ; Wed, 13 May 2020 09:44:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="k5VgYvjG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B12E20740 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 C2DC490011E; Wed, 13 May 2020 05:44:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BDF0C9000F3; Wed, 13 May 2020 05:44:38 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACE6890011E; Wed, 13 May 2020 05:44:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id 94F569000F3 for ; Wed, 13 May 2020 05:44:38 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 587A98248047 for ; Wed, 13 May 2020 09:44:38 +0000 (UTC) X-FDA: 76811211036.20.jelly63_b5804de41b09 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,dan.carpenter@oracle.com,,RULES_HIT:30012:30054:30056:30064,0,RBL:141.146.126.78:@oracle.com:.lbl8.mailshell.net-62.18.0.100 64.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: jelly63_b5804de41b09 X-Filterd-Recvd-Size: 4061 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 13 May 2020 09:44:37 +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 04D9h7L2021465; Wed, 13 May 2020 09:44:36 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=CqEotzK6nQD/0Q7SQNmyOVX9sntRWK4KGEuUznZHTa0=; b=k5VgYvjGFH+F3FqGaJzYhdoQ/RtcRg6ClF6s7gAhpUlBdivzyt0G+mTzeW5ecihp1Wn1 GkC3c71VcZkzvXvTNnIHuutzNC9e5wB3vW6511DdWfMm5bbrvmdjkBrPf/hBcIBZmEwh YLgs0lO//7EHJEM508qU1oMuhIC0O3w10ii808yMcoJLeXiRpP/ydHn/eepmP0IbWx6i 9QNE/tuWJV2PczQ6ooIMWPc9/wMyDNNmXVYbbEKDLv9syk7qCNrsOunfzsCHA1922GJm LvhC+8Ms3ULB5Szav8gE38nt/MerHiPblnk8eIbjbR7x0ohuZwFyHJOTrbgY/TLk2d3h tw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 3100xwb611-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 13 May 2020 09:44:36 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04D9c99m111664; Wed, 13 May 2020 09:42:36 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 3100ya794q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 May 2020 09:42:36 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 04D9gYs7023475; Wed, 13 May 2020 09:42:34 GMT Received: from mwanda (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 13 May 2020 02:42:31 -0700 Date: Wed, 13 May 2020 12:42:25 +0300 From: Dan Carpenter To: =?iso-8859-1?q?J=E9r=F4me?= Glisse , Ralph Campbell Cc: linux-mm@kvack.org, kernel-janitors@vger.kernel.org Subject: [PATCH] mm/hmm/test: fix an error code in hmm_dmirror_init() Message-ID: <20200513094225.GE347693@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9619 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005130087 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9619 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 cotscore=-2147483648 mlxscore=0 phishscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005130088 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: If the allocation fails, then this should return -ENOMEM instead of success. Fixes: a149d2eb654b ("mm/hmm/test: add selftest driver for HMM") Signed-off-by: Dan Carpenter --- lib/test_hmm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/test_hmm.c b/lib/test_hmm.c index 00bca6116f930..b4d9434e49e72 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -1119,8 +1119,10 @@ static int __init hmm_dmirror_init(void) * make the code here simpler (i.e., we need a struct page for it). */ dmirror_zero_page = alloc_page(GFP_HIGHUSER | __GFP_ZERO); - if (!dmirror_zero_page) + if (!dmirror_zero_page) { + ret = -ENOMEM; goto err_chrdev; + } pr_info("HMM test module loaded. This is only for testing HMM.\n"); return 0;