Message ID | 20191003154539.170143520@linuxfoundation.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp553132ill; Thu, 3 Oct 2019 09:26:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzp2MRf7FXvZO9Ligbze1KfmWhmToDCVlM8HFWvcAgG/W4JhqSddxBY7yaLJEcilDthIvem X-Received: by 2002:a17:906:7752:: with SMTP id o18mr8245555ejn.227.1570120015992; Thu, 03 Oct 2019 09:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570120015; cv=none; d=google.com; s=arc-20160816; b=U1yXsLQHw2PbiD4ThSZzEKVOiFJdQh1annwVvW9fRo03E9gQTv8JO5DXAmY384Mky/ n2pIVD7Ih5PXtNikwOMdYxG9qHH44bkeH6qKDI2NzsprJnbxs65vp2uO/ItQCtvJbYHV mwHP9dKt7vklWpG5cBoilAnUEwdqFhQDGlmAgOuxOc6vT6ptlRVtQH5FUdD89AmdHSzg zNJVrW0s+mnBw1acVko9aov8XTuib7IcaAYYMbv49uW2Ur0QBorIuZqDx1Yd5X3bPg8d iMQbuC0NDe4YqUq/ql8OS4C/0LDXqHxmG6GmLqZNi9r2p5FyOF89OSoP7PcnGb9U5mtU Vfyw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zV6NLSZp31BqJog2/3djubuHBBwyDCWf+zdP/R/Ab8M=; b=oaTRxIkkz9koch9iApBrq4ZQxbEJW1cMlAIZ6tSAS+uhbHZQiRYc4plXjd/EMh4Tfx m6l9u3g5yD6vXAuRFcPnKuixoes5iZ4ijornEHhAJl2+xt0OEUe+vdWfd5oZY3uiQjBm 2l4R4Q+irc8llvA+Y4pLCyTVCy0dtXu4f1ggSHWXI2gGwbxfNQEqVvoV6tnCV+USqkuA z99R50yjo6NTYzaoU/Jgzzl0TPGC4afXVtcPwHoDK1MP/bJPOf96P8zZv558Rg+0ctfO Cb4xjo2nHcz9eSneT/FJYDR0bWRCYIrGbjtqogX33tXujMV0KxGJcSp5ElWDs540f2Bs WSQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="X/vzm5+V"; 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 Return-Path: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w43si1867179edd.332.2019.10.03.09.26.55; Thu, 03 Oct 2019 09:26:55 -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=pass header.i=@kernel.org header.s=default header.b="X/vzm5+V"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390452AbfJCQ0z (ORCPT <rfc822;lee.jones@linaro.org> + 27 others); Thu, 3 Oct 2019 12:26:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:58290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391139AbfJCQ0u (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Oct 2019 12:26:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EB9C2215EA; Thu, 3 Oct 2019 16:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120009; bh=5+4+EyeHu/Ui4dWZQbgh+L+4DfByRKwtCBXnWaSYN9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/vzm5+VH/khK90B9bA8NrH9ssySOrudTpxeLlAwOIrJ4IjU0BvNauJW4sbze8QG7 8ISRSsF08Gk4AHUXOh/ab40LrN+UNIce6FzoePhITNPPlnw7H5bmA8oGK0F69LUaty uMeIKOilJcb2X4wazlLm+o1CSM0gQdD+vb3j6VME= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Robert Richter <rrichter@marvell.com>, Borislav Petkov <bp@suse.de>, "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>, James Morse <james.morse@arm.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Tony Luck <tony.luck@intel.com>, Sasha Levin <sashal@kernel.org> Subject: [PATCH 5.2 063/313] EDAC/mc: Fix grain_bits calculation Date: Thu, 3 Oct 2019 17:50:41 +0200 Message-Id: <20191003154539.170143520@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 64922c8fa7e3b..d899d86897d06 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1235,9 +1235,13 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, if (p > e->location) *(p - 1) = '\0'; - /* Report the error via the trace interface */ - grain_bits = fls_long(e->grain) + 1; + /* Sanity-check driver-supplied grain value. */ + if (WARN_ON_ONCE(!e->grain)) + e->grain = 1; + + grain_bits = fls_long(e->grain - 1); + /* Report the error via the trace interface */ if (IS_ENABLED(CONFIG_RAS)) trace_mc_event(type, e->msg, e->label, e->error_count, mci->mc_idx, e->top_layer, e->mid_layer,