From patchwork Sat Oct 10 20:08:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11830267 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 C265514D5 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 537FB2073A for ; Sat, 10 Oct 2020 20:08:37 +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 537FB2073A 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 242306B0062; Sat, 10 Oct 2020 16:08:36 -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 1320A6B0068; Sat, 10 Oct 2020 16:08:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org 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-Spam-Summary: 1,0,0,,d41d8cd98f00b204,dan.carpenter@oracle.com,,RULES_HIT:30012:30054:30064,0,RBL:156.151.31.85:@oracle.com:.lbl8.mailshell.net-62.18.0.100 64.10.201.10;04y8rdkrrkpj4qhohi3oids4nqcmxopuwuka7epmy1c9wn9jgs6y9zhimg584e7.bu3y6w497f9k5uw17ip6sgjszk166i9uk54qza5aw8i74j1khuk51yjeixy6xqs.w-lbl8.mailshell.net-223.238.255.100,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:24,LUA_SUMMARY:none 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?q?J=E9r=F4me?= 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-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 Reviewed-by: Ralph Campbell --- 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");