From patchwork Mon Aug 1 10:19:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12933652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 038B0C3F6B0 for ; Mon, 1 Aug 2022 10:19:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229797AbiHAKTw (ORCPT ); Mon, 1 Aug 2022 06:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbiHAKTu (ORCPT ); Mon, 1 Aug 2022 06:19:50 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F1E11209D; Mon, 1 Aug 2022 03:19:50 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 271AChvG029375; Mon, 1 Aug 2022 10:19:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2022-7-12; bh=DxxDCYhnYzzEHFdpNEHc5RLzNoi/NMxpfoBaiUzjVr8=; b=LTKRyvUg+936fOboTJscBdeN8c9fr/C8rteC48C9UL9bvXAs+uTdn41F/IOoWMLtMZlw sPVnjJGp7nKkUnkZELZue4F0V7nTurZniOlagf5Yfrj1YAu7KMzYsEWfLg4FfAdxgzl0 hfUAUviDBjsOe2XToxxc2C+RUgFDW4tGT0hBN8DXF8PVkJACIENiglMa50Hwx+cuIe0P fmtO+MC/59sS4GnsidKqCqbDr5OukmlC0rCq8QahK/EaITr9c76AXxAVdaTUbCOkp+P1 F9iQPdhyoca3S33/mRK3Wnp3cNjiOCLc2UWM1FNgJGxURhvcLsKLzareL8xpI89lkyXz 9w== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3hmu80u9dp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Aug 2022 10:19:42 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2718ZRSO007447; Mon, 1 Aug 2022 10:19:41 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2047.outbound.protection.outlook.com [104.47.73.47]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3hmu30w0yx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Aug 2022 10:19:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SZ/bN64pYZ4HBqsJHTpZr+PCvpgM2g07SWLtAM1gN9QlszZsWpw1uJD/DxKNOvwy7guJwtS/blWnm7hs5c+8Uc/zabitx9vtlBKgyk9g8sQZlVelm9WCW3KwgSZGqgNxEdOgnRu7Ej4W9n6RqnThW8QC80Y1S68d6KRSgRXmO6CPIUXfnS4CqPYSNt+J6al88tXnC4kRyykah7mlsuR44ccjthdO2O3lCHf0grSOlrTOuh0a3s5V9USwMTlX7/joHUZaz+GSJDA2lXqJ6jz7G6ewjpZKDwRaZqeAe7hnl/1fskx0Ux1g8Fv4LHXqRkQCQ9v6yoThG4IGUJ71o7fs9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DxxDCYhnYzzEHFdpNEHc5RLzNoi/NMxpfoBaiUzjVr8=; b=KUvQz/vMEH4cnwvi5jhXKQ0xWuUPPGXOyquXUjd51PNu0bbKHmEB43xneck0eNi/cJREJ+R7d7tNFMsjuo3cWtZi1397JTkLhE9bHbrZq8I/m1qFwv0clbiMw4UgjO11EswKCclIXb24qbmyx0dCArwZalwpENu5uyS7jesbc+gTcpXDMquX8d/VZRAh9bHWS4MXtX9oQxSyc/pz13CHTI66xJiBEMIyR+EeFtQTscECHOhGtI14Zc9GwUttz8wna0Y7pK9J650ZAUq952R2D3pEtd2zvSbA5azT6T8nGksHzX0XQ2QsJT6FOn2LR0EPcEM9dvzBw97r70zbFAPZlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DxxDCYhnYzzEHFdpNEHc5RLzNoi/NMxpfoBaiUzjVr8=; b=Zq6ymV7nvVjZJpJ0QncBcXI6w9nSWz1rANwHWSsc2SjNvkv0kDC8DoGgFdnk1S9MmNmae13dyWZ82NIeaCrAyK0CQU64kgdFL/EueonviRXH7QCYCYgxpS6ZB8Emik9kuy5z+P4vHetVTNTk9WHg835o/fE7txtvCAzrLmOXKbw= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by BN6PR10MB1314.namprd10.prod.outlook.com (2603:10b6:404:45::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.6; Mon, 1 Aug 2022 10:19:39 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::209e:de4d:68ea:c026]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::209e:de4d:68ea:c026%3]) with mapi id 15.20.5482.016; Mon, 1 Aug 2022 10:19:39 +0000 Date: Mon, 1 Aug 2022 13:19:27 +0300 From: Dan Carpenter To: Alison Schofield , Dan Williams Cc: Vishal Verma , Ira Weiny , Ben Widawsky , Jonathan Cameron , linux-cxl@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/3] cxl/region: uninitialized variable in alloc_hpa() Message-ID: Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-ClientProxiedBy: ZR0P278CA0050.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::19) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6cb82cfe-3cb2-436d-b78b-08da73a75760 X-MS-TrafficTypeDiagnostic: BN6PR10MB1314:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EJHU6ASdAH744d/RYuMs8VETn9TSwePEZqjHcGdALQByNrU3itFOx1U1xNJla/HuCYS5VkRqkTReshq1V9LbEnsZp2kS5fyVdBiTUUTGhIHKX2cR+vjpXDtVGG1STwOTMM4V1ttjUR5KHJPurONdsMgZ3A3/tpqW0wAsDOoZfTeWbzjCxdf7WLp8avPnWLwNMUlCVawCEBb74gZGUMeifjwwa7BxB2lTuYdajGXY6EKdZWuacOkINzFCdG9mCtDfrJNnV/X/09xFU0WvDNKA/WFmnqx2HuA/zYwmrdJUMoJYCyRZhq+uF5Ffg/CLGnRcMultnhI6Y4JpjZAfcv2EpqHTdf/Y9PIVxnhu4wQWNVCHSQGh2mk3psoQB0e7Ky+M8XJ+0uzupcWQnAGRNIJcg36lpGSKQXST8EIrLeuYTQpscASE4dxH4s/i2AtOgDL3JQrlPIlub7hjO75qp9Sd83uGBGZAhY5e6TAScRmtHWUQONAZySkjthKVF0a/HWpiGY2RWB4K2tNPfhlKMAmlSOEtIuDHIUC8/A6ZxNP4GmUXu5+r0XulXyFIBp6BGhGdyD5YmYUQeYtjk9YEd8li6Sng0MODcc79Bz9j6kfNDUT8uwqD6lXUqBsynVrCVSZOsUEI5caPBys6KgiY/s5TRFivjcV1Nls9sLJQuWU7sEsrvjVt3utmgHY1fhotLrVXEYQSE4FUNhZgOVMfu5TrO/oRu4K0ZqNWxkR/r7OLTd0HuM99oNy9rbejPvav9EWqg3mUBileAglKkT+88nVgS8jGTGFXOxOpaToeCTlutsMo6OyFVNHo3UtfKTUvVmVQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2365.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(7916004)(376002)(366004)(136003)(396003)(346002)(39860400002)(5660300002)(4744005)(54906003)(110136005)(44832011)(316002)(6486002)(66946007)(8936002)(478600001)(66476007)(66556008)(4326008)(8676002)(6506007)(9686003)(2906002)(6666004)(6512007)(86362001)(186003)(83380400001)(38350700002)(52116002)(26005)(33716001)(38100700002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pbEG9S++1/OBivH1b/L2/1q19+CrtitGuLmZeqoIJlE5PdmMpXNAacN1mpy6iMFRbkG+c+J6R5yyzYs4rSPnxNraTL5fg/2FHAIkTFaKLRSltt7/bhyo47yJJ2wBVOdtVV+TF7ceoxGIbQttwb/O8fELhZ9Odb+EaHWKE4hVsqSASI7PK0raexbX41EvsWxaNlXlaYRYTjRGyZ1zTm54L/gEmW7yIK4ra60fHxbBIhOAQ4DmcjluW9LDYt57b7BeyfMOlbzqwn0jhaAMuFhUx8qLt4w7rqtthMrLourTSDlV9Vu+23HDa8It0r5OYzJACOBKkzExZpEWrZ8s+q2dNvJwWc+zjXMyw7i+5StKwCgZn6KGTK3Ny7FSa7nJLblbqIVOUn37SyiRfryNWBZIMED59L92E07Ql8jeoR0hgSXpsV/XLqTX0YgrlS6sY21YF1nTrNPJTPaB8JKIRvgWTtQQUXmatflJPGo5++yziIhFE1zqQo4afcqkRjUBJTv0FY+FLUvPmb/KbVuDwwy1e6F3FXosuVfdNLwwL6gg6s6xnRbwnY2CeNaxwiKkLs0FztIwYeif/ageBT7Wg1OC26g/yOIY3XUgXUfg8JCEYQaD3kBWvqYysgsRe48Cu7DeoI6cbEgilFHXjYdNMplSQi1b9SQpfLGpSDoyg/iC4OTyv4Hox4SAl83ZjMFEjn57wlskRX/69WRN0OG+8oIbAUFDPddl1IU7im1ufggvr9JyMdmtcW7uuBI+yCAlygWXvv0fUz0ANa14umFCKP5dIihWpylYCTKptyyT9zkJnhdMsSc0ImLcjESSwSStiP/vdbhJYykKANNQ4ksED0EGwicqD+avf2kKyBVn4k9zQd5WgrnGXm2N5WcLEewlLAoP4ry1LlDUz44pcpt6WvRarshOsyPH323S1fhOo/r86ySZRwuhg4u++myN4NfDqvlxWfjZbktZBeUTJ6/ETAr9a3hkHn0Zx/E8dvs+AunIU0hlzp5PLkbYM8MmpgtNVegh+46bEK3X9kbsMdP7pb429b7Sxs+UapIrQyv0eETDzTFzlMd88rFaFLENe2/wuNnA8WBtnIp5XYZJ0XtqkyPlJtAqgx9v/ul/RBJ71YU9BNqDhuWSdcowgz6y5LQtkS/z5lnhi/jDCF33RDjkSuyQyiTLbtRlbRTkoPSd493cVei8bwcEhDGS+/gve3+bYhmsoWBXww947/1Q2nMjB4OEc2Q9aAFGR2iLcAIm6HsegkOJroQkeVbsn6Xvj1iyRZUR9pwJAGmfxMNY+WWAHBzQx2sDbGwHpGeJ/X5a4MbPBVEGemF2AGyu2ZklPUmWV2hS9LemubVzt/ZppjXHoCeelP6qfFekifji1yT3gdNj03pB+/rKqc4jvVtFY/nDYLR2rjYGiSH+d6f8mtwTF/Y3LhziTMYEvQsRZFo5khVj9dV2jARFP0eL2hPDYENJrstqktMxylgiuJVboNCFDOwCScGNDBzOOZ8R+Utd4CBxm3LXhMglgJoOgJ6pn+EGBSZ+M8hXBssvv3d84xLCH34It40izd2RQYs/iYdSENDzxOLNJg8pSmfkySXF6FCBai4JsglA7/PAAy7ElgCrL0Sf9g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cb82cfe-3cb2-436d-b78b-08da73a75760 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2022 10:19:38.9972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: L6kl0ecgHpgE9lRXNKzAirzPR7qAKFnH+J4Ku9FSt2Ie8nZzdxG095QdNSVIADPGkGXG8EZ6AcwjQTf4PntnF8OP/0gVr7s278mt8en6fB8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1314 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-01_05,2022-08-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2208010050 X-Proofpoint-ORIG-GUID: HX3phkSYi7mVF-PUFSJw2RotHCVRw1zR X-Proofpoint-GUID: HX3phkSYi7mVF-PUFSJw2RotHCVRw1zR Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org This should check "p->res" instead of "res" (which is uninitialized). Fixes: 23a22cd1c98b ("cxl/region: Allocate HPA capacity to regions") Signed-off-by: Dan Carpenter --- drivers/cxl/core/region.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index dc71ec457608..c80932bca667 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -454,7 +454,7 @@ static int alloc_hpa(struct cxl_region *cxlr, resource_size_t size) lockdep_assert_held_write(&cxl_region_rwsem); /* Nothing to do... */ - if (p->res && resource_size(res) == size) + if (p->res && resource_size(p->res) == size) return 0; /* To change size the old size must be freed first */ From patchwork Mon Aug 1 10:20:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12933653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36A95C3F6B0 for ; Mon, 1 Aug 2022 10:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229861AbiHAKUm (ORCPT ); Mon, 1 Aug 2022 06:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbiHAKUl (ORCPT ); Mon, 1 Aug 2022 06:20:41 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8CC813DD4; Mon, 1 Aug 2022 03:20:40 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 271AChvg029375; Mon, 1 Aug 2022 10:20:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2022-7-12; bh=1kvutj+ISWtpU/wC1mbVdjVwlXauHKOJ0st9ThctLqE=; b=ps9u9t/WKXPskyl4KudTd43UC7M0KXES9KVVRAmuC1s+Oy0ktJoOBhr7gjIyP2DqzsrK Xeo5lSv2Q0emAdwfChNGoURA4NQnUigBrfoneBtQbmTBmxLdoRbW3VOElZVDxJHDTeC2 4S+DsvKEfUO5jRmmKFVSw579HH84cr14U6+PB8tXVmh9q6wFvA3Y2kVqMhOcAjChisA1 dBH///pBX0MZ5ajR2+uqUwWYy2BfpUAoc+3mFtJUG7DfPiu7JJFltTrcZeyTNcp2G+gt iefsAMjOeb92Vj0zcPKzeR8x5SKOyKyszQQxLevgMahFIJyzJJ5HDv7s+6GMnRF76e0A 5w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3hmu80u9g7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Aug 2022 10:20:29 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2719LgqU003269; Mon, 1 Aug 2022 10:20:27 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2172.outbound.protection.outlook.com [104.47.57.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3hmu314gtc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Aug 2022 10:20:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KATt+lCVIQIKQHzOby6lH1vPDpnNpit5zhlp4wWSeHHjXCk4VO3ysi8Jl6jVkZ9RoQ6hFwrE8EzTGfu7VXhgA0XVosZIGtgs2veHE77LtwaoEJO2d0/6wEvkSguH9y9DZKJDPlSR6HDwz1lU82CCYoOAq0NrNXGeHnDYzmfqP4DWRYI79znu3YlAqee2hGRsHMzz4RAYzdx5V5AQymcn6q+a4GGCVpXtVsCdU8sfLCAjOWSfQPQUJoGkDAiILDuWKSm/GnDbEYZwf8UwdyUiIkmUW053xquevUueNRXiVTsZFFubVXjusCng2Lll5CGuGYxgFOLsLIvnNOAC/QGpMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1kvutj+ISWtpU/wC1mbVdjVwlXauHKOJ0st9ThctLqE=; b=jtXZ5cuAdai4aHLKW401LPRl83U9GiDSWLnaMcfp6owxgy72plhl88uQRaVkYtzUEXHb+5P1V4jKs2NDfyUdPJYdyoB1fTAkHMBzIvVmyjGIhfCeIeqDaGaS+lOeY0LE7m3amxMIJ4RtWlwzG/Optae88sYIAmqN3XMZisuLwDWdOWjLvq+aWjfCfREs6mfU+9sskSHl1h8aOft2yvOiJhJU3A00eUQVfHkTmbqsE1bygX4iWVA0IsXGXaClI65o4VvpE1et4VuIwhblLW3F01VkOwlesmwUFDzuXJzQ6zuXU6CUvEjNHQSWpVk2aRfiFDFVecy8cpR8A9wUdflRpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1kvutj+ISWtpU/wC1mbVdjVwlXauHKOJ0st9ThctLqE=; b=ipqLgr+U6eHQrweITi3pJkGn1uyRjoAZQiXnRa7gJWe9H663EoeDzixBqr/0R+BRSu2y1IY8kkRxsyIUvSjcXu3eXSVYZzBUpi+kYJMp6BGhu8/+nrDdEIfTcrI/lDspZg+SSh/D+LJO4qbqKGqZReh5uFt9YmAGdng8Dr8l/iQ= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by BN6PR10MB1314.namprd10.prod.outlook.com (2603:10b6:404:45::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.6; Mon, 1 Aug 2022 10:20:25 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::209e:de4d:68ea:c026]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::209e:de4d:68ea:c026%3]) with mapi id 15.20.5482.016; Mon, 1 Aug 2022 10:20:25 +0000 Date: Mon, 1 Aug 2022 13:20:12 +0300 From: Dan Carpenter To: Alison Schofield , Ben Widawsky Cc: Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , linux-cxl@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/3] cxl/region: prevent underflow in ways_to_cxl() Message-ID: Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-ClientProxiedBy: ZR0P278CA0083.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::16) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ccb942d-5e69-4c21-a972-08da73a772e0 X-MS-TrafficTypeDiagnostic: BN6PR10MB1314:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BDUyQojeK4zV9l9ZRrYAXm9Su2wDdG0081LlfNWL4PeQry+S/AxG+lLqhQLtO1PauooldrL2f7hD87i5b74+HuB06GMk3KUeII/PBdwHzI4P0zUUdcFbcKSNYJNJUpNOJ1UoZdvObE6CRb9FcUfhfdcUnbGs7BGhabudMAoEydIucovhLc+RWBiwAR3bniPi0cDmhDiXqAHb6VjzyMqs6RYD5WUF3lRnX0zwJJESrzn9ykaBkrYobFuA5hTXbjkPsadkzGjyjspFZO5v/4tdO/sK//kIKK1ErFH0J9d1JEwCjnVDhZexzloH2GMkfSd8JWclDb4f806LGF6W6vNdaQJUlV9MfhAmRORwFf5ljI3dfHz+RoUKkfR/vISbsHvV/WjVtHZ4rAMAm/a1Yd4stkTLaI9YNaH6d7i5w6hPo2avdwlzSytquoF/rL0uee7k7GCzWbvsjqxlwBfYK+gYPBM9RH/0ZzYj5NbBUHQcxEMD8OY9VDyQYFEFCKjYrVsCGZklLqXBUx3TzkUlSWSgxgOoD7aeW7NaA6uHktIjvFbtx2EB5u7evdq9ajBnVr/byrJTV210eMQ93l+HHDunal3hPToZPkQYPPIq7iPQFRK31p8hAjuEHnKA+amqFfllkvvi7qfzQuwvHViVr25yFZSH/1IBB7dYdNxMc9IzenatxbCqRisUgPY3fyi1dZA/zXfO5fiT2Qlc9OEQaN8XDjpeeFkK9V8xZq8ZedX6nbpiP577e9e3rIBDdlbnP4iho2QYecT7l5QW6nXkKQyAvKXDx86e80m3RLhqOneJPgOcV2YEpDX61bTpc/1Wfqpl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2365.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(7916004)(376002)(366004)(136003)(396003)(346002)(39860400002)(5660300002)(4744005)(54906003)(110136005)(44832011)(316002)(6486002)(66946007)(8936002)(478600001)(66476007)(66556008)(4326008)(8676002)(6506007)(9686003)(2906002)(6666004)(6512007)(86362001)(186003)(83380400001)(38350700002)(52116002)(26005)(33716001)(38100700002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RhMt4Wnu5eziXgRrMvdrg31ID7JFNsA+ZgmvO9ngCi/jtIX8pJwvg/aS3cGqUpGH5j5DhQO8tpUZkNH67AhEb29LRPPPhJ2uSi2JNHFTjv9oPVG1Cxv/2/FXyyTC+PRcftSW654WiGrskTADRQS2AxMp4q71WUN+z8DsdC3hmKJFIkcjx8cN9L+8wfbWgnYtgupLmKZwTuv5b6KWn8jdglNDS5I515P7mBtbiyVPKCZyjsRFr9bNf6Sv8d2C9jw3Yc5LIHdsMmfOqtI5qr16tugdXEa3OVjEZJ8aCkAEy/QPffxbopd5Mb1X/CA/FhA9S23br8LmjlljiAfXVm4I/4olX7936h6nhaXevFwrkqvv+ojRVtkYpMN7iUvjTeLi44tJo7Zh0iMMgTIcp0IFqkrbhRpIknUYdithemw6x/oAJEINvVRP6usNLsCu7ZErXMxtYEZm7a+SpdT1EyfCsKuI5XrjjJFFxltL5hCjQuPJJ/nXIyUvsvx4u8FYnvyvWoQJqUSs8CsLFZpcGGLrm6ps3fN8It9GWXNMF0AyNxsulN/y0GVdlLUJMjCHAhQFZxk5LinoV+WnZo/AAJfzGAwM4ZiOnAfkN6iJ2cxp2AsNHl6rVr0VWu2Hfw4iCizEwkIfOye/qkNqQG3nA1YzDt3X2Ln8iBaZjv6GSDg6+gwaa7+X+eBozSCxUZwBEdwLDzy8+PpksNpv2POXJfqfiiKXTogAhOJFuKUgXczKdqx0Gk84nSfUsj/6bZ5J7XHr5RPb//SKqtEX+JrXVV+ZRJQWcUor1lArom4Mcchsq9bA0iwvqvxJX2oRTFRxViE6Egee7mo9EfAmhp1VNkQivIARqCGxJJZQRlAyh/+d2Cz7F3AWGQPJuoBHt1icGb0yaAU2NMly8v7RTkeL/VgYh8DZaNiBdoqROWyja9JvXmk7W8UR7PZskT9/KLlNVpqUAGdV3B2DFpLNLUS1GcGSbB1Nlm+YB52psLX49LbRzVPfeDXCM8C9NmsNJd55F8xFWYUkksLwaYZh2RgTAMq0nMV+a2JTY2rcIVG+lQFmNeig9ISIJESViyWzuIdX2z7A78KHE96AtVu7jVG89ZWwWREE+tOQL1o5UDkrx7BCN+fhJ2WwyUrbj9ocD1x555jsPgwQUab5Z869zpfLyl4oO+OGxDT09hCG/gOdPPkgfs3y9ERYysZTqPUBkc2qg9e0HzY4WMqXezZMJxMG4L/9zvJaYNgljXSSOq2tTHGr4N5z8z/JJVK4v0lQ3cgDEkQceb7M5vQebFeqoZgJdzDl8lubk/O+HXlFZvk1yYwrWhkeS6xYUW8L5FlB2N+WbK7zbsSqbxuTXwAHBGTem9c256FA959ZODrqRVnx6wrLkQ3SVzYrl6QGLjrMmzGHeD+hbt+A5MuuYGZ/FtbpT1jkFQYHe/cZiHchR6p8g25cvBQhqtotyQpQX1cUcuFbC1L3yNqCdzZy2xnBfcs2H1cHR2cnzHv7pQGikf2TUyWzAJEEiiFB23rFfuEEp+guIeqtR/k4Lhe+S7tTe66MbvzYvBn3hM6zGYBKYpEJiZzAxXiWBsjnVawqdHwvd3eJv/fsswUlCMLt08CZ/KoiFVtADQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ccb942d-5e69-4c21-a972-08da73a772e0 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2022 10:20:25.1498 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: z0FC3iVUcqhxE0MV4zQVG4qVBCvv4goNjNtU53+Ctb7Sm+Bf2wIRazTU4pCWIm+cOaO7EvqURZZIGEXts0pVt+6mBdqXpwI4Z9LMBjkprwg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1314 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-01_05,2022-08-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2208010050 X-Proofpoint-ORIG-GUID: WD0hlE9x6xB0svA02mxe9HQeKBLKEXP5 X-Proofpoint-GUID: WD0hlE9x6xB0svA02mxe9HQeKBLKEXP5 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The "ways" variable comes from the user. The ways_to_cxl() function has an upper bound but it doesn't check for negatives. Make the "ways" variable an unsigned int to fix this bug. Fixes: 80d10a6cee05 ("cxl/region: Add interleave geometry attributes") Signed-off-by: Dan Carpenter --- drivers/cxl/cxl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 75674400cc8d..969953ce2609 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -102,7 +102,7 @@ static inline int granularity_to_cxl(int g, u16 *ig) return 0; } -static inline int ways_to_cxl(int ways, u8 *iw) +static inline int ways_to_cxl(unsigned int ways, u8 *iw) { if (ways > 16) return -EINVAL; From patchwork Mon Aug 1 10:20:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12933654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC1A3C00144 for ; Mon, 1 Aug 2022 10:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229903AbiHAKVZ (ORCPT ); Mon, 1 Aug 2022 06:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbiHAKVY (ORCPT ); Mon, 1 Aug 2022 06:21:24 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0B5C14031; Mon, 1 Aug 2022 03:21:23 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 271A0Juo003148; Mon, 1 Aug 2022 10:21:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2022-7-12; bh=RQBXb0JdSg5pfO2KK2+p7/c0U9rL4SQCRXl11ErLCS8=; b=q0E439QK465PbI/h7D9iGnHQhIx+ubhYxFxSoX3KZEkU0OYB3TjDkP24DNBYXDCanPUS o3KeaPL6G7B96J8XCaOTUCmK2zA2Y/4U94/bhK6nFDpHfctT42a5iys9f0qoeiRw63lg fpUm3UgLaGyJriVKZ0gpv1MEiq/64AYcKa2IkycSZwHGMCu/5Wzwv9Im80rhPv4m7UAI ypMz2ZPCo5OvjES2c79dllEdDlzQT0PoRCjRkGHXj0/h2TNOY/+qMRfC2DxsqkATCHAo WrViGv1Lf/6ZNe+y3wnH7JBjEKd5LxTvqFH4fGtrqYvQ62t3+vqwVJYhJnrReKmdEdRY NA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3hmv8s37ar-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Aug 2022 10:21:11 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2719sY0R002985; Mon, 1 Aug 2022 10:21:11 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3hmu314hj3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Aug 2022 10:21:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hsrkuKDWY10bbK8xXGu7rXvqufBfl1/B07nguAklDbWWYZJK/6R4rDFD7Ja6e4eVGgQPbMEre34p8MDQiIvNvW7HIjBBjD2moa1jEhXpd811IrQ0ky2hUuPKb3G7VxQlxLJAZHmB+egElfAVoodM1N5ZGSrJ0zKPmqqM1obXsGbpy5NEUfenbcQePwCOifwTy0ZoL9jwS2FxwcvPEH77vB7FJVDpDZceAYq+84/d+H3ro0uKTOqv6ukGafpR0eJne/6GUjBPh1JmkMUFy+qSe3PZISKp8MGOolM4HJbgAiR+rCo5WrcPXVLUxQJFC+zTMQQsm9RYOQQBaB7DODw+8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RQBXb0JdSg5pfO2KK2+p7/c0U9rL4SQCRXl11ErLCS8=; b=gJWzesc88O6M7StjQFPGXVi+UzY1sXzhBvwewPfL81Mhe0yqGuJAkcCWxkdE+dMJD35bqpWinKIFLdVCKOUfPD/VMxcZ8ROOrnKK2nwdbzz3KCTD4IGHkC4gvlWrWU2wPw6+Y1jMNn5Ot6aL7m1sbgaZx/M1RpA7xIMkBEJazoOLhfVPcykKvKIP4ZmZ22d0rKxXYjbdsI9bCs+/3K0dBQxzb50+Nj839ZDPz0i1zIWiLAJfo8RUlwhwh7S8JmDhhsI31zoM+0UxyIieXUdcQgWMbWOCUUBIFSZvTf3wWg9m3NLriWiXCvxGWCfCGJ4Qgr10EyvU7yzjR7a8U859wQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RQBXb0JdSg5pfO2KK2+p7/c0U9rL4SQCRXl11ErLCS8=; b=ZCyVx94nyRZlB/AxHUWeV4gKtuSipN49DzIreS7OkUdHnp+nV6BQaoruASNoWZyJdndEryMghzJF7V4BfpaGrqzg28eSRVRaYyvL/R3XZyDsX7niqBw+SkMSqZ/j8WPTy6PKRgajrOaDbX7bAZyIi5UOMrA11SpaAfG8G1bCnDs= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by BN6PR10MB1314.namprd10.prod.outlook.com (2603:10b6:404:45::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.6; Mon, 1 Aug 2022 10:21:09 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::209e:de4d:68ea:c026]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::209e:de4d:68ea:c026%3]) with mapi id 15.20.5482.016; Mon, 1 Aug 2022 10:21:09 +0000 Date: Mon, 1 Aug 2022 13:20:58 +0300 From: Dan Carpenter To: Alison Schofield , Dan Williams Cc: Vishal Verma , Ira Weiny , Ben Widawsky , Jonathan Cameron , linux-cxl@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 3/3] cxl/region: decrement ->nr_targets on error in cxl_region_attach() Message-ID: Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-ClientProxiedBy: ZR0P278CA0037.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::6) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f25a9aee-8903-4d82-4fbf-08da73a78d09 X-MS-TrafficTypeDiagnostic: BN6PR10MB1314:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0QKkTiwTnwtEB/vEfCAMSOfFugRNNmUJeMqtDOFyPwk8eole66FPg+JUEBb51gzS7vUpaDWPkmXjiotbKbuNAyd5vumrmd5yKlkCKgY+q1AfIFWb91n+kY1aQK6fsCdBErV263yX8gtNfL38JQUH1kEE4z93J+AFxCghIMsiMem15t+chXfJ1CZYZfZb0ZI8FjAy4RX9JbxKQyzhDZxD2Fc8fVwwJiv0IEY94fIpIrdJla6KER8zNOhvw/FbPZ5FAqDeQ2GLN6i+LsyEY2dgCCrojaMx81KG6G6uC/ZZEeaCD6RQromX1sTuT4fv6SnLXkvEpFYBh5xDHSNKkjd5h4JYy4y8WSqd2Fe2ArgoEFYVcQNKuqRIDdOcpXJmzAcHfw849Fh9VGE+Vh3Gp/XHZ2Ff+IRja0P5klIe5m6g3noUVfldLOTjXx1wMFNtdfYp2rbLUIr1d2dbC/E8f4rfL6SNUIM2/GjeqxRSGXy7oJw4vY9PIPH58x4A0CfYMuljlxSMyKUj53pK2E5W02E01X6Im1/PzmEUS3yemm/an37uxPZkcrjeQEuHFCVRZr/JXzodDtqUmNpMeUR1dot3LJ3eBJk/SQ8/+9ZG4HKhyFFhqX87lLGk61QU6r4mlMVP78sGbzfkED4yHhv/PUvmX5uAjD9RYMEU3k88XHpeljBkj4a6GK+9XITJ+MmumXz/Rv4YYpInW9C63e7lRZriLjkwih6ugiABCmjT96Uv//U3hFOZDSjKR3wVkE+Aj2quGh2IyVMZGmx1yRnBq+iz4ggoy6NyrHIO8J8xemyPqoKpPoSkMdaDzY3Eyz60mjUB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2365.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(7916004)(376002)(366004)(136003)(396003)(346002)(39860400002)(5660300002)(4744005)(54906003)(110136005)(44832011)(316002)(6486002)(66946007)(8936002)(478600001)(66476007)(66556008)(4326008)(8676002)(6506007)(9686003)(2906002)(6666004)(6512007)(86362001)(186003)(83380400001)(38350700002)(52116002)(26005)(33716001)(38100700002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z02IBXY4MXju03Hdvv62wCg3BfQI86oDBvmdGran44d9XflFQpdrOGmTC4MEAH6ZJY9t8RCSbx9oOS1OCGgCDsnVOQ05pYlVLXkaXx0Mnb4aRZphwLXnMZmuAxlbNmz7LoEcaKkwIuGcLolHO5JGuut3EepA2BGElIND2HmFpvwnk8VGruwx0L3yLqsbHny8uN/cJGygbg3XJzRbQOl+0bP95ESFiKCW3R1ji0zFXusZMGM7XNjnryyk/Hua65sqGFn+9VtKO3oaSHhFij9ACEH9CJmQH4KO3iwE/k+TrfWNT9cmHqa9POmQMBheoYp21gVYb071B6yJ0fr4pt5i9eATBCC25fyoO0KVXXC+iYBapVyf7NgehXYqWCtamZbIs1fQa9ExURjJYNv/poV9TWTCN7wgoWx6ly3gIho4c7sSTaujPiBMr19aE+daLdjVaskqKr7f5fO0U/c1BhtVCPr1xaEu+VuB9y9zCaBWGfK4egcjpqeTDmsk8OLILzZdnI9w/FFBMq06deDbflLoBwummx6dkvcjkFtvjaIl3rkQ5xF2kT3BBKvM2a3oKg15myi0f5VtZxhs9HBscLroD1Voj7ltrPySV3c7QCGcJV66w8VUvvTEgtBHc0ln5E/wk08iC9s0FTfZE92z85mFx01VHiiWHyukhXEw8f2SFlzB52NKOL1DXPRyL4ERZFXRGsO8/pu4UynwnInqEb6keK1EI+oVtUUGdQ6UUwqAOlqjckPckTLv2CU6RT90fkf/mHiX0DHOZ4hLZ8oklS1TEBZ/35jbrvUheEAjsDGF9czhHU98TFXTbJabIWMQlyROhB+HQ5roDZjOz8yuSoUhT6HYz4Hm+x/9m4oSJvGXsxwWBX8vbVQsISz+V4fEt7szDyUu/lKQbbW0rBmeSRV8VZgpEQZV/1A2y0EZ4F4K1q/HFxSPt6B2vDdSF8OsioFH3MMxRpgcg5epsn/1N/XzfMWazuQF3wcSnfQEtC+SCCmkdGaLDI18vyGS82npYPwz3hnlh9lP/iI7W8ntrViQSuJziM+HARUgqohXwU5pmj9VEYEP2j0MEMU2DAFRQPZI1APsv3JYwfpdt2MybJAlIpPG6MxDpgY1wLMqd2zUV6fW59ZEeOF5cWNXB/mIOGOYaEfyA7pqQ+0Rsz47IZNdjjj9tGGdcAtU2coXuX7+8W5pClpGQJsdXu5eNtSWvEgIinDP9PyLyKLHIZUpEEwv3QY7CYGHblxFldtkW8lVBsmDod3XhFCnFOC8R7i9XqtL+ATr5zEwlhoJlckl7lwl8xM9tGZKQqMKrthEmhMXimrvyAr5jM3G23WzW3oXA8nf78ZpFr3ZMAHF4fGncJoChc3eAFflcpgepjpkH7SDfmSh+wYO2jXqRn6nGwqi0EyZaNtxdvcBoZoQo3msPz3m82Cz4e1OZyCu07KtQ/2CMxyR258YNpmgyXBiwbKE2r5UvyaCJDUyjbIwAaiMKkJUQPUm5p1AWngu6UiX8SK4AZ4/T/kGeLNRkJ5CQ28nzhZSW9ki0DfFIYe3M6YUz9pocMK1lHStNx72u2+dRbxiP+EE3wuRP8m6bpjm9cKrXg7ySeW+OYvN0B9EGHClPMdImg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f25a9aee-8903-4d82-4fbf-08da73a78d09 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2022 10:21:09.1932 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QibYDt/A5Zhiem/Ujo+N6TlH0k/2cnpgJAS0obqtO9Cyqcjulv9xvh6nw28g1W9OC2pAs7zOg3WJpgiGClxlc6g2/nJAI+HUBt88oyQ4MQU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1314 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-01_05,2022-08-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2208010050 X-Proofpoint-GUID: hbLRlZKbjcBayo_d2TKMVD8RkhzU7Wva X-Proofpoint-ORIG-GUID: hbLRlZKbjcBayo_d2TKMVD8RkhzU7Wva Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The ++ needs a match -- on the clean up path. If the p->nr_targets value gets to be more than 16 it leads to uninitialized data in cxl_port_setup_targets(). drivers/cxl/core/region.c:995 cxl_port_setup_targets() error: uninitialized symbol 'eiw'. Fixes: 27b3f8d13830 ("cxl/region: Program target lists") Signed-off-by: Dan Carpenter --- drivers/cxl/core/region.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index c80932bca667..0450354bff4d 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1217,12 +1217,14 @@ static int cxl_region_attach(struct cxl_region *cxlr, if (p->nr_targets == p->interleave_ways) { rc = cxl_region_setup_targets(cxlr); if (rc) - goto err; + goto err_decrement; p->state = CXL_CONFIG_ACTIVE; } return 0; +err_decrement: + p->nr_targets--; err: for (iter = ep_port; !is_cxl_root(iter); iter = to_cxl_port(iter->dev.parent))