Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp719675ybp; Fri, 11 Oct 2019 03:18:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgncf2XnPoMiFUnewerf/zIGQYhO+SRXke2knYJDTcQOMN2Lh2qp2j62dIEgGFvCNh+wbu X-Received: by 2002:a50:fe0f:: with SMTP id f15mr12400876edt.89.1570789113929; Fri, 11 Oct 2019 03:18:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570789113; cv=none; d=google.com; s=arc-20160816; b=d2VU+3lgYmj1c9X9ymEuR+tneNhCKgy/ve6ewBNY5J9dJ7HXGAuaRKQ6xhzdKsb2Dr jqcM+XpKARymQ8OzM3y8wnowm9mUeS+7a31Z+txcEI25W4rg1eHQi1XMYIJmWQ45FnbO 8y6KnTSSVUM7VN2yvrHvu8bkneriupNmrDyZTe+uhaMCh3ztbf0lahIjPvzMK1HUfVjU DZt7v9gMVlcLkknzXps6/hgDkrFb+sChMyzj7fny1MDl/mHWs7kHN0UnagPwjwHh2kmp zjygxqOj4lM2llFf6wn6B7OMJ2ej5aUF2MTa+hof3OCxvS7edeHHEPGjwxhpjk0k1aFg I4hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=hwAR1Sr46cSaooqzU/ZAWX1QuPmPGh5n5goPhXbgX84=; b=XvP5Hs3q2Fmmdxv7eJ+f1hmBGs1w9gXhH9bF/qs5yT3RxZ7wrTiQCUmcaOydZvxv6/ CuQLk8B92DUXVSPIKf/Q8h6zujmTmYkJZcUFIMVBOiXU+T322ZWOtr17cSatngs5t6ql wUcL8723FV5SVKu58Jc31A2l1UWukm0LPQZTcczk56TFxuUzBMNJ2X7NZ8fXpqiAcZa1 VTQV8aTwp3GgDh98gpNYCoDVYhOTUu6GMhAEyYuHIPdNuG9JGNZ0y7R06AxnYqU96ROA Y7qQdfpXpxDxMBTpeRHtepyEQAKUHcO5HJQRhl91LlJ+Mc8ldoc4ZtarvQD8KziSA4pB zd6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=CqYZPhQ8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si4881627ejp.397.2019.10.11.03.18.10; Fri, 11 Oct 2019 03:18:33 -0700 (PDT) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=CqYZPhQ8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727668AbfJKKPb (ORCPT + 99 others); Fri, 11 Oct 2019 06:15:31 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58290 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbfJKKPb (ORCPT ); Fri, 11 Oct 2019 06:15:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hwAR1Sr46cSaooqzU/ZAWX1QuPmPGh5n5goPhXbgX84=; b=CqYZPhQ8646YFp3Ha820yNtHl Q/IBaN2sO82C028r3cQGksf7M/GL/Dgt1xQxyZdEhgBkmrHRT/MjH6gMLUoVr4IOoeR53fQxdhRbP jRyQjW2fPKTn9rWWPMh0axSwPq4OSxzvpttwcpZn2tqEC/vw+iTicF1bUaEMsiz/EJNrRu3nXtDVL 3i4cDEkQgaIL/F/mOBLgES0IB5JlKw1HwqS3UIq1yGPiaVCeIrjWUIH8067ABH+9s0EtqLgX1cSlz /UZBts90XbVn7MG2KMHCRQH8/TNw4ancp3jPx4HEv7dOQ+B/q9gFUeG5fcf7Rol87pfAihNhrKgcN idJc0GRqw==; Received: from 177.17.141.107.dynamic.adsl.gvt.net.br ([177.17.141.107] helo=coco.lan) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iIrxH-00034M-W1; Fri, 11 Oct 2019 10:15:28 +0000 Date: Fri, 11 Oct 2019 07:15:23 -0300 From: Mauro Carvalho Chehab To: Robert Richter Cc: Borislav Petkov , Tony Luck , James Morse , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 04/19] EDAC, mc: Do not BUG_ON() in edac_mc_alloc() Message-ID: <20191011071523.1f121599@coco.lan> In-Reply-To: <20191010202418.25098-5-rrichter@marvell.com> References: <20191010202418.25098-1-rrichter@marvell.com> <20191010202418.25098-5-rrichter@marvell.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, 10 Oct 2019 20:25:12 +0000 Robert Richter escreveu: > 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 = false; > > - BUG_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0); > + if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0)) > + return NULL; > + > /* > * Calculate the total amount of dimms and csrows/cschannels while > * in the old API emulation mode Thanks, Mauro