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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 65E4EC47078 for ; Fri, 21 May 2021 16:12:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 E9AAF613DB for ; Fri, 21 May 2021 16:12:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9AAF613DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/1/qZmQAADis997MwZClNbrYFy2Yfo++u83F3ErgZcA=; b=EFfJKuqmj6/TUvu5Sf7DAt0P/V yrs0694LN9izFSDPTMER+8IXN2jrklQUwm6sfN4GAtTY7Gjm64xc5xJrkxZCTlqyX3HxUgk+g9hRp ZkJFKY6jioUxQISDIsreNiBy8IrruJwY7rZSYQ1rJqJG0x85wONGCa/y9QSxxh6dD2sLSF+gss2CD /AU6tpZ+jpteX2KenKze9k7qa1QSZx9Qzw+Ge02SdZ8QMU0zOcpKQRiSXyez3QgxTy+g44z4Ny0CB ZVkIiSsjDQqJd5w0g7r+EqRK1sz88D3qmwSFi0fi7rFMZ09aR8/HEfyldimGfK0sNALfHwwvQTC6X oDNbaoyQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk7jj-000C6u-O8; Fri, 21 May 2021 16:10:56 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk7jg-000C6M-0Y for linux-arm-kernel@desiato.infradead.org; Fri, 21 May 2021 16:10:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Ihp+ytTiUWgyI29GTYcg+5bxVmDMKZK1zsaXkk3K4xE=; b=mGgf/ZsZCy2xwjOlJ84FdXdajC 0Xw0G0QT3skBkUL5UWMPYc9Wf8ePSyUUACjlzaLONqeyI7+dN6LAnNTL0VREEoIXuphP3rZVe/S9b M/Va6bEtZNLjsN6JT6oFK2VmdOkhtAnHJ8ZJmLGMyK+tKsp8siMmFJfOppLeaeQ6JSRMcBl0sDeqL 6vU84qol5eVMePWTOhiGdg9Qk4q0i4Uu+HHH+tSvP7VeAzOJhm2n9GxI+RQNSzikgVM5wrCTWWi1B N4yZWUn6RvbPxMtbOxM3ptbRSuPaly/OLPqpg6WHNl3Z7OZ+6e65LMcPlx3XD5sj+sTiDf1QO/92E OlOT8a4g==; Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lk7jd-00HGWo-Bn for linux-arm-kernel@lists.infradead.org; Fri, 21 May 2021 16:10:50 +0000 Received: by mail-pf1-x42a.google.com with SMTP id d16so15235902pfn.12 for ; Fri, 21 May 2021 09:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Ihp+ytTiUWgyI29GTYcg+5bxVmDMKZK1zsaXkk3K4xE=; b=p2tBg1d9u/a3/D4ni57yw6Qr8GncJ0y7CdjDH308OVSvY/9/JJLSnbtj5AiTlJztes HHHW/CtPYfQDSeOURZwbfnOoeFiCBsrJruqgDTN+N1YBeYvWz+B6NQPM6KGS/Ac2fwfC RtjZz1CkZr0QvdxDey79m51T7EOznEYxc4nUUG+qZr9gf3cmV5L9fUxnNQR2f6/s+eHd 5qfUiDUxZwWH2djNBMGeWdDSZWMrsnfy09Stf3O1hSYGKVK34O5+ms9IDGNR1VkdWz/E 3JllUJiQ3C5Gf5tXqdgw3ULARPsG/uupOzCKRMdXG6BYLehdFF7dVHYgY6hMw4m/EBcI 9hjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ihp+ytTiUWgyI29GTYcg+5bxVmDMKZK1zsaXkk3K4xE=; b=qM4EhmOhyk+jGngUOQ8xuaW4axfqicprhrTuTLY/I+kp54aB1/GzS4wwEFNzWZiRii CFqA16w6wRhAVW1oTOpjRuKPgIwR5c0I9IWfAmBFTNkrMiWsIzr0vsERqajDtoJZ8n6j dLpbCpjyVIxGQd9PGA0CeKQ69iHcAr3yMbSSCbZuAhhVvjEIDwhpsc0Mk5owzc7x+Sep sck/5SkBMD7g2G0G4z/y3rSbOTTJlTqrbe97WwUoI+EUgqSFwaowCg4gf01a+k8J0foJ VOXRUkku7Fvbp8YcysBfnIkcHhBjjfBQu85rsc2Yc28Hx/FiqwAfkevOFzQma46E7TTc vGDw== X-Gm-Message-State: AOAM5323Yx9qeJw5mOd+XFMSyIaOmXbv9T39Y+Qbl0sVMlbfhhiV2rMJ 0JNO5TQmd9OOMmiyj2qNiQ+d2w== X-Google-Smtp-Source: ABdhPJyKjFkdsHzy5Q4L+90L82Uu4TBusygqvXkQ96AYJo3A0jmoD68prbWof+A26qXxLMlLGxOChw== X-Received: by 2002:a05:6a00:224c:b029:28e:6004:d0a5 with SMTP id i12-20020a056a00224cb029028e6004d0a5mr11014805pfu.1.1621613447355; Fri, 21 May 2021 09:10:47 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id s8sm4723599pfe.112.2021.05.21.09.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 09:10:46 -0700 (PDT) Date: Fri, 21 May 2021 10:10:44 -0600 From: Mathieu Poirier To: Andy Shevchenko Cc: Greg Kroah-Hartman , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Suzuki K Poulose , Mike Leach , Leo Yan , Alexander Shishkin Subject: Re: [PATCH v1 1/1] coresight: core: Switch to krealloc_array() Message-ID: <20210521161044.GA997016@xps15> References: <20210520135041.56163-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210520135041.56163-1-andriy.shevchenko@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_091049_424289_A0D5FD96 X-CRM114-Status: GOOD ( 17.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, May 20, 2021 at 04:50:41PM +0300, Andy Shevchenko wrote: > Let the krealloc_array() check for multiplication overflow. > > Signed-off-by: Andy Shevchenko > --- > drivers/hwtracing/coresight/coresight-core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c > index 6c68d34d956e..a7971c68b0be 100644 > --- a/drivers/hwtracing/coresight/coresight-core.c > +++ b/drivers/hwtracing/coresight/coresight-core.c > @@ -1730,9 +1730,9 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict, > if (idx < 0) { > /* Make space for the new entry */ > idx = dict->nr_idx; > - list = krealloc(dict->fwnode_list, > - (idx + 1) * sizeof(*dict->fwnode_list), > - GFP_KERNEL); > + list = krealloc_array(dict->fwnode_list, > + idx + 1, sizeof(*dict->fwnode_list), > + GFP_KERNEL); Applied - thanks. Mathieu > if (ZERO_OR_NULL_PTR(list)) { > idx = -ENOMEM; > goto done; > -- > 2.30.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel