From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D38C0C388F9 for ; Tue, 27 Oct 2020 18:31:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36B8C206C1 for ; Tue, 27 Oct 2020 18:31:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="EgbFsJdf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36B8C206C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 49EA16E0DC; Tue, 27 Oct 2020 18:31:24 +0000 (UTC) X-Greylist: delayed 345 seconds by postgrey-1.36 at gabe; Tue, 27 Oct 2020 18:31:23 UTC Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by gabe.freedesktop.org (Postfix) with ESMTPS id A8F126E0DC for ; Tue, 27 Oct 2020 18:31:23 +0000 (UTC) Received: from zn.tnic (p200300ec2f0dae00bf53706700052072.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:ae00:bf53:7067:5:2072]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id BAB771EC0212; Tue, 27 Oct 2020 19:25:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1603823132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=HIlEQ668ZK65lA6MbCzNrMzTRfwiOqR1WIXbuHA3yjs=; b=EgbFsJdf1OZ3IGcke8XXZo3hz2cAmj/RcULw8QVmtef7YinSrbWCYFvbL5yywQPkzemwXO N724w3YmM6BIy+GiS4LbNct6nLnnKYjmBEbvDSj3xaVvbYC4cp66jlosXNW/p8ekCy1vAQ YuPzn8Qmf75kT/ZiIBq27HMK3PaA71Y= Date: Tue, 27 Oct 2020 19:25:20 +0100 From: Borislav Petkov To: Bartosz Golaszewski Subject: Re: [PATCH 5/8] edac: ghes: use krealloc_array() Message-ID: <20201027182520.GK15580@zn.tnic> References: <20201027121725.24660-1-brgl@bgdev.pl> <20201027121725.24660-6-brgl@bgdev.pl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201027121725.24660-6-brgl@bgdev.pl> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, kvm@vger.kernel.org, "Michael S . Tsirkin" , David Airlie , Gustavo Padovan , dri-devel@lists.freedesktop.org, Jaroslav Kysela , linux-mm@kvack.org, Christoph Lameter , Mauro Carvalho Chehab , Bartosz Golaszewski , Alexander Shishkin , David Rientjes , virtualization@lists.linux-foundation.org, Jason Wang , linux-media@vger.kernel.org, Robert Richter , Thomas Zimmermann , linaro-mm-sig@lists.linaro.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Joonsoo Kim , linux-edac@vger.kernel.org, Tony Luck , netdev@vger.kernel.org, Takashi Iwai , linux-kernel@vger.kernel.org, Pekka Enberg , James Morse , Andrew Morton , Christian =?utf-8?B?S8O2bmln?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Oct 27, 2020 at 01:17:22PM +0100, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Use the helper that checks for overflows internally instead of manually > calculating the size of the new array. > > Signed-off-by: Bartosz Golaszewski > --- > drivers/edac/ghes_edac.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c > index a918ca93e4f7..6d1ddecbf0da 100644 > --- a/drivers/edac/ghes_edac.c > +++ b/drivers/edac/ghes_edac.c > @@ -207,8 +207,8 @@ static void enumerate_dimms(const struct dmi_header *dh, void *arg) > if (!hw->num_dimms || !(hw->num_dimms % 16)) { > struct dimm_info *new; > > - new = krealloc(hw->dimms, (hw->num_dimms + 16) * sizeof(struct dimm_info), > - GFP_KERNEL); > + new = krealloc_array(hw->dimms, hw->num_dimms + 16, > + sizeof(struct dimm_info), GFP_KERNEL); > if (!new) { > WARN_ON_ONCE(1); > return; > -- Sure, why not. Acked-by: Borislav Petkov -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel