Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp353948ybx; Wed, 6 Nov 2019 01:34:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyObL3sWzT6dzEJJufJDnG5RP9NFBGdmoKiovZMUWR3RPK6Sfn1p4hnEXxGUwNkpvVK3Isl X-Received: by 2002:a17:906:f209:: with SMTP id gt9mr15272170ejb.241.1573032859522; Wed, 06 Nov 2019 01:34:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1573032859; cv=pass; d=google.com; s=arc-20160816; b=rtGNOpSpuddVaoHbi01jDRf/mMNymtbu77GG6Wlv2aL8gf9J8dXU7GOcXtIrmsE/Ru foAwWv5ZIJqkeI/o8295+8iTskIuWkha6DZruNG4vUfGTYusnTmDbZtHZUk55phfCZ5X mONzD1jr37m7oXGRY6kUvOYP9uump4PWjO7Uk9aLJryn1OjwWHO117cdvna2JARhIsap bn3dC5JTU65BSqcpXeu+uU6ngAxAtN80E3UagQ7b9jlq/blBaDRibJivtf0YwLBe6v2J 6DFmo+MUFNoaiMThcBoEY7u0PV3NH5Ro4Pu+cYV4IFc6g4N1j3VpA50JXN9pyY1Q9ktq gz8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=aLaTuVZChfzcoBY6BX5AGWUoC40fMoccLj2A6AQxBNc=; b=IctQbS0/jrpPGhaTN65jYRxxkK4IfZSiFXnPRupHRdAiNZQU82J1OmR+Xc29yH7P5u to7BH2pE+LYEV2IosqkLJPuHRj/ogdmUGFBFi6jj7477KL3/6/EYyciWZnuy8lUYwzwH ygcmVLHC0z227icf6+p7Go7l5EWwulcyFfyhm+FbpzdlyKLFLMPfp23yuX/MT9qLRvT4 pcrp3lkiiQsCOQ7PT7N1nhy5r8uEz55u9m+REhaPlIR/4qYbjMtLDrhkvV+M8zhHfISE 6kymHA7J+7bDAQnT5UR3YdcxY1K2+vLHUZBhsGWYGi4AC5D6Yqgqm2PPomrPKNl5Vx9q lHMg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=I9Mt4UAU; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b="dmc/3sKo"; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y40si11582066edd.383.2019.11.06.01.33.55; Wed, 06 Nov 2019 01:34:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=I9Mt4UAU; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b="dmc/3sKo"; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731029AbfKFJdV (ORCPT + 99 others); Wed, 6 Nov 2019 04:33:21 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:42896 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727642AbfKFJdT (ORCPT ); Wed, 6 Nov 2019 04:33:19 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UIxI002503; Wed, 6 Nov 2019 01:33:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=aLaTuVZChfzcoBY6BX5AGWUoC40fMoccLj2A6AQxBNc=; b=I9Mt4UAUR0186E0dVwxThSbamnLtfqhSkHMjIWkF/oocaDJ8bD4D4btUZ5mFQfN1vca4 P5/RtfgNaBjTWmVZCHTbJ+bEhGYglQJFJv/cwQu7tGtBk+5gSrHgIe2tsDIRW1Zp5f6V 0mPBSGXUjH8gGBsXfFZTLEUklSlLpJTtl8KtQm0WKhASxVLYooUkhrRn/pzAiTPDtwlw LC7S2zVPtmWTInE+w0cmw0EtSUwngayYS7DqqerygF40jFURrQmvYegV9Yv/IAhuF+H8 sYcKAFIBcZJzN4pKGz/ilDp1Q+IxOSHorgk6ZUEexFZCN5ymMUMbxIEZX+wGaB5Wxt2P bA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c6h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:12 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:11 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.57) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CPz2cbitsvDgyGZWm4NuLTbNregSZ8L1traQTRGow6k8CIGMoaUyHtl964IlHy95aKQ+l0vKaHY7IBSblG6KODPEObZXF7QqjfVK83IhHgL0QgOfazZawFCzmQN03jbva+dn+j5di0Zd3zKjuLrJaTPgHveT982vgj4Q1eucMLXa4IVtiBKZUElFzpefpdrCx3bkF4FeAzYJ2a8znCbhN51qZRTMhnZygbTi0yDAxcO+2Ir2pgvVQ+drpT5P/Rc14LoV99RgNc9ni8TCp8kVmD6xQG4Rmykqw96XtdHvmdCVZejlKde+FxWdgrNxkG0qx81ruY2dcntC3BDIjOHRQw== 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-SenderADCheck; bh=aLaTuVZChfzcoBY6BX5AGWUoC40fMoccLj2A6AQxBNc=; b=EXAWTgVVbOBXYE/1P0IPcgRmJj+pjlbYCbwDKGSuMJWVl2O8R2gcPl9twauiAG0esJ5C68dCBHtlJ+rKCSUWcmDSXtL0LwGj2EMAhLeRH58aOxxfjDIZJdBB20nuhRTmRERTUKWmeT+u8SCJ520mncV4zwWVPRnJ7fm95iakaSkrCj+HRH4WxidB5HUArrsGs2UpkFhd1ioTONaQBmHQyJ6atC7tzwSFQSu2zDoS3GdxDP02yvImkYf9652yoEsbuIt3XKwbZgzLlQ/BgxSmkLVnNP1k1LW4jTMuTgPo+1kPY8yj3lLVjetC+su4Zt2EHlrelVN885PE7vHwbX14xQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aLaTuVZChfzcoBY6BX5AGWUoC40fMoccLj2A6AQxBNc=; b=dmc/3sKoXCicSnuZL8pDy8AKSV7QtnCXZTK+HtWEt2xiGuSLKiuFHw3T1akUiICdB0c5ZVbDedT/buwomN/Pm2/7Q1Ntfv/xhVrldvBRYSlXAH/onwz+tnUVS3lElE/x5iDnrrA2OW9orQaGENQCdJM1htF0nbM7Svi31w421+U= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:09 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:09 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 04/20] EDAC, mc: Do not BUG_ON() in edac_mc_alloc() Thread-Topic: [PATCH v2 04/20] EDAC, mc: Do not BUG_ON() in edac_mc_alloc() Thread-Index: AQHVlIUz7boQWMifeEOuGHD4/0UIaQ== Date: Wed, 6 Nov 2019 09:33:09 +0000 Message-ID: <20191106093239.25517-5-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f1438922-e2cb-4ad7-3426-08d7629c55ee x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(4744005)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xuVTvOqnYvzCV+XioAJ+xN+YDGUvTYwZC+R+c/3Ar8oCl6B/A/roJV0xeqgqpV3aZ9kZutTy/QCCg3UTbbJm1q0zubA0Oh2NyGfCYEzj6Ma0dWnen65AZ6gF/s+YPVqZ/HFRBWjvIzEPlOU6YidfgUPCNuAxHaf0VQTMDQT9XR94RfTo+ymtH3e8ZCYK69nFEx1yFLWUBuKHNEaiEsVItBaciMGJ9wlVXJeChyBRA3KfguzbpR0QnviLfYFx7/Cbs1wfswN5li4ODIGlJEbVmIQp7yQHAHUXb4NIxAn2mt/Dc+PozE/vgZ+TZghgslVX7JYmdXYJ73d0FwQsDqc5eSS5XmiroNo+Al22P4Sbj+GFSSBFgxu3TUqWIZCBAqw6WfHVyD3AQ94l3CBEYwUABmN848OjvZ+LYxULkwcs2uDlNok1m13+2rgMUVzVN8cG Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: f1438922-e2cb-4ad7-3426-08d7629c55ee X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:09.5707 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LXgYLU15vqg8A+yCjGZ/0YkaZxEVmOhtX/hChHOgcmg9nTYacAQhj1O9vGE7FcrhO2wKeovsjQEABfiH2C2bCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No need to crash the system in case edac_mc_alloc() is called with invalid arguments, just warn and return. This would cause a checkpatch warning when touching the code later, so just fix it. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index c5240bb4c6c0..f2cbca77bc50 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -323,7 +323,9 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, int i, j, row, chn, n, len; bool per_rank =3D false; =20 - BUG_ON(n_layers > EDAC_MAX_LAYERS || n_layers =3D=3D 0); + if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers =3D=3D 0)) + return NULL; + /* * Calculate the total amount of dimms and csrows/cschannels while * in the old API emulation mode --=20 2.20.1