Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1402789pxj; Fri, 21 May 2021 13:23:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynBE5/Np8HbpTdA3jloLIz2CLIn836BNNUUTu5nRqQ4IW0GNqRjqqqKn6vL/LnlcgJ/qrH X-Received: by 2002:a05:6402:2750:: with SMTP id z16mr13304641edd.355.1621628616090; Fri, 21 May 2021 13:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621628616; cv=none; d=google.com; s=arc-20160816; b=eowB9M9DEqyPLNa7P11a5WOUiLaeuEyUmotFJOWO++8Bi0weQpe5jWjJ0hnHoqPDE6 mE7U3WYHtzzMaW804+acZ/iTpIaA4obzs6neUtzg33q55BJ3YDlP5nVme22XW4kYaMRn yjMhv4CmWOOz6s9nKoO1XdjHrM1VmM2wBqaP137Qp63mXbasFq9VlF1rZC87uXqaRMRf 4mdZuOyuJeV2wYpwQMdg3Z2ekfSkF0V3IEdKEm66siABkUka2gYEsPwy4kpq8r5QS2Ef DHDG1sk1vu9+EZ6H8fRF4Rb/qYXd+YYbApxFSfR/HohmHh4OdCbwGH7iEfiqguVUV1QC m1jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ihp+ytTiUWgyI29GTYcg+5bxVmDMKZK1zsaXkk3K4xE=; b=QT2CVp/RUP0k6FeN4Ya+xCD5s04Ufn895BSL9TvgD9d/d217uV6PXD7rzKNKzVlIa4 eaPEw4enk7e1+BSDjNTf/LIr2RyjGFs2hkAtL/3bozsFu5RQYLIZKw0nK3kB+YvdrCWD 5pUJGxV+gA5WmBIZbjTsEavNo55VUWP1JLxrjNbaF1e85F2dYp6M8YrhbVoi1Q/4OSJO uE0EYY1nee72qsPbl4TZcjjkSWXOo8ZVzFAtcCiwmQrhePQPHAFJKAKWuTSMcuzvj9Kk L/M6xTWNwPDyoALMyAfQRyMbFfsPZ3jIf8OT8GD0Ca0rKy+fRzHzSMwADAfWv19XXt3e e7GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p2tBg1d9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id op2si6407514ejb.68.2021.05.21.13.23.12; Fri, 21 May 2021 13:23:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p2tBg1d9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234935AbhEUQMO (ORCPT + 99 others); Fri, 21 May 2021 12:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbhEUQMK (ORCPT ); Fri, 21 May 2021 12:12:10 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAABAC061574 for ; Fri, 21 May 2021 09:10:47 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id x188so15237107pfd.7 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=qSz4vDAEPDCg75SGpTa5Vjb7GuUjDTIWGPPvRz3s6mS34ZQs+rAFTQxpvypL+ejECV VbOqCB7OIhXh/VJJbVz5aOzcNYSucF9SY466y6aN4sacPWo9FjgXd3wgn7KEj7lg6mAQ KfNfZQmk+rfqZ1fFmxRUAVBGvI3HqW3r/s9jC2yeK0CxI8bf4sa9ZcWlnkpjgQqEbA6D nK5T6UBpsjNdmqiW3viuO8x6RSusomMfyNQ/39rScZMQPDNedU8YOfx0gR7gQlFqYphe rb+xz2aJ9LKZB1ejnCyvA8Z0BbkZnvvY1HdkC+3Powr0eZvAFQsSxuAWTo3ef5Dm5vXa oBCA== X-Gm-Message-State: AOAM531ZnClPl5PhwXj6HIhl1NPq5qQDzciVCVELMUtPSx4fX5ORM96/ ev8pgy2VrDDwZmNEL1MGYXxCnQ== 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210520135041.56163-1-andriy.shevchenko@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 >