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=-17.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,USER_AGENT_GIT 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 C22C6C433ED for ; Thu, 20 May 2021 13:52:51 +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 8C09B611AB for ; Thu, 20 May 2021 13:52:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C09B611AB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=KzDyvuDipzKfwxX2T9OCjxtmX/9MnJqzCOoPy77W58U=; b=ZNZaOjJKvE0AOC+cwzH2SzLNft Yi680AnoN2DPlmRtXYZaXPa6VrDPZNyG3do4w1UJoSk3LO1sPfo0iwMzsz+T5iCdAFABSClae+OdX 79HDfV14viBctVRb2EqAz3PZq0IcSWfVeQPbvu7/EUc9JFwQQg6NysqmLCqN3+N8U9ni4xr71jQHR MEa1vjXOcoQmSaQBsHEHHYJl+OTN+730RCyvFtcIJU+bl9y2hU7FTE/8E03eVqXXiDJ5NHuMcLo2K fZ+1OaFO66ckT2RO/upeULtChWeOec6thJYLwQV1810/xqshWZMxht6f64mBGMFlz9en25jnNIuv1 ED5b89+Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljj4K-001HGs-SV; Thu, 20 May 2021 13:50:33 +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 1ljj4H-001HGK-HG for linux-arm-kernel@desiato.infradead.org; Thu, 20 May 2021 13:50:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=rXo359OOjyWJA7+PrD497BxRZffat6BnZkK1FRi61Uc=; b=23L3ZAchFaaNgUuNz4alKDWfPi RQtXfWKl7EHAmyo6/sG6toN+joM/h17c9qXeE6zttvIE3XbLtOqEYfN73pnV66bEj731fESCIsaVe 8w008GJa4DDzV0QxP6pITbaASeqn/VnxBoYtwySvADTshEQCSTnGavKaNPV/wGe/7isiNLzBGR1zj kPkg+dpz/nO+jIy6MdJhxh0u12TBBZg2GSuh4M4vuLhF8mFZIHrva9GNGZlwNq/Jv0OskXhUhOlOI inBy0Kbc/3SlKqGZQt3XoMQcBtmbKWiw/SR5oXXbkU8iUGtSCd70e8H2o8XOk24lfyKUND4VxSeVJ ls+W1Eng==; Received: from mga06.intel.com ([134.134.136.31]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljj4F-00GO05-3E for linux-arm-kernel@lists.infradead.org; Thu, 20 May 2021 13:50:28 +0000 IronPort-SDR: dFk6FLiKX570xMtcShw4j3gkrQMu1VyuTHDu2IQ55fyF/2s6sNn5Sk1SFBqKi6pIJBk0lUg8Is +vNRjQhCVLfw== X-IronPort-AV: E=McAfee;i="6200,9189,9989"; a="262452203" X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="262452203" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210520_065027_191053_FF225AEB X-CRM114-Status: GOOD ( 12.36 ) 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel