Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp166370pxj; Thu, 20 May 2021 06:52:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1/hRmx2m2lwuLRgmoSESzYz8h848ee+5xhN/ogYt1kIuUZwGs3SrLIp2/bx22RNxs7MeM X-Received: by 2002:a17:906:38c5:: with SMTP id r5mr4639865ejd.230.1621518735439; Thu, 20 May 2021 06:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621518735; cv=none; d=google.com; s=arc-20160816; b=U2bN1+4uJgVZEwX9PZCD0S+lVnu5y+TJ1hdpNzObGHW/iNSQsGkmeAZWrow96qQ8Mm 99Uib8wZvu6dtoqRMwfn778GPnKMlN7IDX78f5zy604y4nW/kwU55R30gWhSbXgbu9cH GLX2LD5a70l/ph0ebOhnJb0WhR0nUxUeUp+nfiE9+FcEXBHO3bixD6qVUrBtI3XxkZSh 0mbT4XZVY2dv1b0lsxo76Pfog/SDpkdkjElnKn/DpG6aHJD2BOTh7XYti3EFULOtdEzP U+MCzWmlrrOgITIr6uMotqligbkJ39fQW1Wvh2h+OcawKp68HsnOb3161YWA5wR1ypPp S88Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=rXo359OOjyWJA7+PrD497BxRZffat6BnZkK1FRi61Uc=; b=kSYe6ryl/jIymheu7flr4bm0eeO6Q8MMIRsx1zkB76YNaOGOFnr6kh7wcpweatv52T DbpReCxZ4CGEs3sBGkWAJP/h+exre+vwh0HMR7QQA//60u8GxBjNK4Kt6Mqzbs4UMsA1 goDICLC8Jwnzdy+fvia5N0DUjssnjkXajhgqx7f2u9uf1ddt4lHTmb7zOUepSuT5gEoG Cs6F301PsVLne6JgiN7KgGEk/ZMbGXTuCssM/3HHzwCwYHzJL2Mgn2feqyL070rRfdrS zcYYu/c2U6tfIQTgVJhfJ01kZjxMWn1HOmB+VXc4RWif3mFYWgNU7d1kEirnvMVTbEtU V8ew== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si2199047ejr.268.2021.05.20.06.51.49; Thu, 20 May 2021 06:52:15 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239121AbhETNvr (ORCPT + 99 others); Thu, 20 May 2021 09:51:47 -0400 Received: from mga14.intel.com ([192.55.52.115]:46824 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbhETNvr (ORCPT ); Thu, 20 May 2021 09:51:47 -0400 IronPort-SDR: 5CAE9O3ytHr2n1JDDuPKlIPKN6avKwiroJN5ZqvPSN/IFbwPpk7zmWQ9y5dkd8xonUriVL+lnr aBL4Z3fNP4dA== X-IronPort-AV: E=McAfee;i="6200,9189,9989"; a="200931046" X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="200931046" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2021 06:50:25 -0700 IronPort-SDR: usIQ2blDcpHo2GhwUkQ5zTclH0xpCXHzJYPIi1deRSrWr+15RF5kVxVI/VmBtj7GvFO4x6+lCm qisOTp+GmUlA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="412181833" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 20 May 2021 06:50:22 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8A47012A; Thu, 20 May 2021 16:50:44 +0300 (EEST) From: Andy Shevchenko To: Greg Kroah-Hartman , Mathieu Poirier , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Suzuki K Poulose , Mike Leach , Leo Yan , Alexander Shishkin , Andy Shevchenko Subject: [PATCH v1 1/1] coresight: core: Switch to krealloc_array() Date: Thu, 20 May 2021 16:50:41 +0300 Message-Id: <20210520135041.56163-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); if (ZERO_OR_NULL_PTR(list)) { idx = -ENOMEM; goto done; -- 2.30.2