From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Sat, 10 Oct 2020 20:08:12 +0000 Subject: [PATCH] mm/hmm/test: Fix an error code in dmirror_allocate_chunk() Message-Id: <20201010200812.GA1886610@mwanda> List-Id: References: <20200513094225.GE347693@mwanda> In-Reply-To: <20200513094225.GE347693@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: =?iso-8859-1?B?Suly9G1l?= Glisse Cc: Stephen Rothwell , Ralph Campbell , Jason Gunthorpe , Dan Williams , Andrew Morton , linux-mm@kvack.org, kernel-janitors@vger.kernel.org This is supposed to return false on failure, not a negative error code. Fixes: 170e38548b81 ("mm/hmm/test: use after free in dmirror_allocate_chunk()") Signed-off-by: Dan Carpenter --- I messed this up earlier... My devel version of Smatch prints too much garbage so I missed the warning when I first wrote the patch. :/ Sorry. lib/test_hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_hmm.c b/lib/test_hmm.c index e151a7f10519..80a78877bd93 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -461,7 +461,7 @@ static bool dmirror_allocate_chunk(struct dmirror_device *mdevice, devmem = kzalloc(sizeof(*devmem), GFP_KERNEL); if (!devmem) - return -ENOMEM; + return false; res = request_free_mem_region(&iomem_resource, DEVMEM_CHUNK_SIZE, "hmm_dmirror"); -- 2.28.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 DF019C433E7 for ; Sat, 10 Oct 2020 20:08:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 379B62072D for ; Sat, 10 Oct 2020 20:08:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="fUmnMPNv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 379B62072D 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 291606B005C; Sat, 10 Oct 2020 16:08:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 242306B0062; Sat, 10 Oct 2020 16:08:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1320A6B0068; Sat, 10 Oct 2020 16:08:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id D6B416B005C for ; Sat, 10 Oct 2020 16:08:35 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5D6B41EE6 for ; Sat, 10 Oct 2020 20:08:35 +0000 (UTC) X-FDA: 77357103390.02.vase07_3d10c90271ec Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 35F1D101731C2 for ; Sat, 10 Oct 2020 20:08:35 +0000 (UTC) X-HE-Tag: vase07_3d10c90271ec X-Filterd-Recvd-Size: 4283 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Sat, 10 Oct 2020 20:08:34 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09AK4YJC124759; Sat, 10 Oct 2020 20:08: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-2020-01-29; bh=l4MehOBSki1MlyoBVVMqnZ9yjHjhqpcliYksNNP4rJM=; b=fUmnMPNv5v4eHs1Gb0toQEZekMN1C5izjAf3hi0I95wOoW+hQPxZA4IA8RAG4a5eE+rC VUh037RbpUWEMhkrK/eiTaADhARKt9xQv/exNfhqSncqJ5ANmNDeXgB/of5XSaPki5qY 7Gp1aE6t2R4mOxn0M2EWewCOkouilkWv8k4tROItY1j0pQgb4aQ7AHsQ5MBbVbBR+A51 TV5ki/27TwlDVfxa1C8ynrb/oAtdgHFhUX+aL1bW1Zc92pWjmVi8pN6ucL5P1Jss/mtL 8Ej2FLCJu9FW48y08VFzeblF23kKxNwIZolMRjukQ2++ONW/VohbeZyp75124IKH3/Si FQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 3435km961b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 10 Oct 2020 20:08:26 +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 09AK5TMX066381; Sat, 10 Oct 2020 20:08:25 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 343309srd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 10 Oct 2020 20:08:25 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09AK8Kia029518; Sat, 10 Oct 2020 20:08:20 GMT Received: from mwanda (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 10 Oct 2020 13:08:19 -0700 Date: Sat, 10 Oct 2020 23:08:12 +0300 From: Dan Carpenter To: =?iso-8859-1?B?Suly9G1l?= Glisse Cc: Stephen Rothwell , Ralph Campbell , Jason Gunthorpe , Dan Williams , Andrew Morton , linux-mm@kvack.org, kernel-janitors@vger.kernel.org Subject: [PATCH] mm/hmm/test: Fix an error code in dmirror_allocate_chunk() Message-ID: <20201010200812.GA1886610@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9770 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=2 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010100189 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9770 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 priorityscore=1501 adultscore=0 malwarescore=0 mlxscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=2 bulkscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010100189 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: This is supposed to return false on failure, not a negative error code. Fixes: 170e38548b81 ("mm/hmm/test: use after free in dmirror_allocate_chunk()") Signed-off-by: Dan Carpenter --- I messed this up earlier... My devel version of Smatch prints too much garbage so I missed the warning when I first wrote the patch. :/ Sorry. lib/test_hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_hmm.c b/lib/test_hmm.c index e151a7f10519..80a78877bd93 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -461,7 +461,7 @@ static bool dmirror_allocate_chunk(struct dmirror_device *mdevice, devmem = kzalloc(sizeof(*devmem), GFP_KERNEL); if (!devmem) - return -ENOMEM; + return false; res = request_free_mem_region(&iomem_resource, DEVMEM_CHUNK_SIZE, "hmm_dmirror"); -- 2.28.0