From patchwork Sat Nov 23 20:05:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 845148 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E580EADC; Sat, 23 Nov 2024 20:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392368; cv=none; b=O5Ry7xXHU2mvhCSiglDzrAc/1xehr00WurxhfaQAbm27LdNGw1eoLLe0614Vv7Z6CdUSLrF6RQTier53StK9+aBufF4P6ez8bYyb2HPIaUz2jZAQx/Kl5fTeS4r+/CHue63dmNV0+KCHhWTq3hRHhZ+wlUbCZ4xK6GuyO3dztXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392368; c=relaxed/simple; bh=GAVRYml17ZCCg2g/TqAnTGzAqhZE9Ak/JKtz3LbjUIM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qFjoPs9ns+LF6SqB3V4ny/8FZ4uGb3I0agGoWtsS6QxO1+QSjLEfurXuDiFI4N+c1wcrfr+Fi/DHDQhQoL+xb5Y4uwyaCoWV6johsSBpTPBMNIKgDPbMCmjOB45Tphm8QyuRZDyQfrzVAXt2EEkLDjNYiX6/YaEY5j8I8K4Tm1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gu1woTtP; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gu1woTtP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732392368; x=1763928368; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GAVRYml17ZCCg2g/TqAnTGzAqhZE9Ak/JKtz3LbjUIM=; b=gu1woTtPHUUACHYyz2OhodXXZNhApq3G8bnxPdncV1aRSw4Yv4v1o3e2 0wR0ZHxailJ4AChuYMUw0+vUjK1ydaIkrqD55aZ0YLs6ytXM/EkWHYEhs +fCDXe7DfBG6rMkyuG6/x1cHDArwzLHG8OESAgg1OpBEmKTMji8Hf5n4Q rS5aqohgmvx8INms8a1kuqvvtUK0dQFmJn8u8ZIOxvy62xeNbQIjWqbLF F4CowKVtCrYJwM6htLxsczuRUSOc47qPmW8exssonhppRljK+H8Ou6Lp4 QVaG2uevdQG3qbopgIZ7GsUEkvyvHMoXRvMasOzyD3asQiE/h8oQCof03 g==; X-CSE-ConnectionGUID: zgcox2U0Tb+b+nBOs4uqbg== X-CSE-MsgGUID: NNvXVSc8S8OmEnjTpe1mmw== X-IronPort-AV: E=McAfee;i="6700,10204,11265"; a="32678533" X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="32678533" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2024 12:06:07 -0800 X-CSE-ConnectionGUID: zBITnaUiQJmn8IRYzPjQhw== X-CSE-MsgGUID: 5h/8vyTRTrqbkDar/CjIZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="121737991" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by orviesa002.jf.intel.com with ESMTP; 23 Nov 2024 12:06:04 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 0CB611CAD1; Sun, 24 Nov 2024 01:36:03 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id F18BD160010E; Sun, 24 Nov 2024 01:36:02 +0530 (IST) From: Raag Jadav To: gregkh@linuxfoundation.org, linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.dev Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-sound@vger.kernel.org, Raag Jadav Subject: [PATCH v1 1/5] devres: Introduce devm_kmemdup_array() Date: Sun, 24 Nov 2024 01:35:23 +0530 Message-Id: <20241123200527.7830-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241123200527.7830-1-raag.jadav@intel.com> References: <20241123200527.7830-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Introduce '_array' variant of devm_kmemdup() for the users which lack multiplication overflow check. Suggested-by: Andy Shevchenko Signed-off-by: Raag Jadav --- include/linux/device.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index b4bde8d22697..c31f48d0dde0 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -358,6 +358,16 @@ char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc; const char *devm_kstrdup_const(struct device *dev, const char *s, gfp_t gfp); void *devm_kmemdup(struct device *dev, const void *src, size_t len, gfp_t gfp) __realloc_size(3); +static inline void *devm_kmemdup_array(struct device *dev, const void *src, + size_t n, size_t size, gfp_t flags) +{ + size_t bytes; + + if (unlikely(check_mul_overflow(n, size, &bytes))) + return NULL; + + return devm_kmemdup(dev, src, bytes, flags); +} unsigned long devm_get_free_pages(struct device *dev, gfp_t gfp_mask, unsigned int order); From patchwork Sat Nov 23 20:05:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 845146 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3CF61A2C04; Sat, 23 Nov 2024 20:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392372; cv=none; b=hynJHXyuW4OwLwpxgEEEAM932pC+RdDIG3pf7E7ODsVjJcPdkDH0mSQO/MaGDLeDkfVv5ciVybVUIj4kCI3YkJf+nGwCe6MUmWWDhHKLepZaglCQJsoB66WtXDvodhD23Omo155w8MU6kNwkZiJC+JoPs5UHnNP64uiLDa+Jdks= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392372; c=relaxed/simple; bh=6Tidakgtdfgzj7ArIO1jYC1ie3c1/PQNJd0mdhYzvBc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DQl2dp9bj15JOYAR+/ZUmhMYttCJwr0TorV4R/Fi+cdHdjtP5UhoyoVvIX2Bf2Ne6mn3CwDAD5SrxGZUMKIYPD9HjSaio46Shi44QZhrYrHYmnyBZtgGalpgWvIk+jQ/7d11YFko53dAJ4+5FPvLyYj4hl/1XO4AZK8Ez9QjFfU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZVls4Txp; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZVls4Txp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732392371; x=1763928371; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6Tidakgtdfgzj7ArIO1jYC1ie3c1/PQNJd0mdhYzvBc=; b=ZVls4TxpWL9TOFkLWuavA58QCniCnFf1yoa8hOgbo5DSqZtnd0hy4cnv 4A01qrhCp+cd1miramVWRWCbYG6l7Wa9Nrh6luy1oNaLOXuJlEB3o7j5s sOOjJ3XUEQ/Bx/4CB6USWRTWi1blLwhE4P3+laIXk4J7cAYVhokKQobQN cDepYdY9XfqU+ZJ/eTkgk25zK8yahfQF/Py1b9UBEDtmOPX9P8/p3dUW9 Tz6VntDRgG/nXKR+bJsga+vx0IghkbV6fa5TQvWI2/4q/b+SOcqya36bH lwxX6quGPRwplw9WXcqJLmNPvGZOFXUAcYEkK+yJHTPCgFOmDDoiWkXxb w==; X-CSE-ConnectionGUID: z1+T5w8pR6+qbw0ctwv01w== X-CSE-MsgGUID: UzrV04f2SNaQHrnnJZHR6A== X-IronPort-AV: E=McAfee;i="6700,10204,11265"; a="32678568" X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="32678568" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2024 12:06:11 -0800 X-CSE-ConnectionGUID: gq5XiFlmQXaPSQXFGjj4Uw== X-CSE-MsgGUID: GYw/XiXGRxuIzfgUMMrHPQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="121738002" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by orviesa002.jf.intel.com with ESMTP; 23 Nov 2024 12:06:08 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 3179E1CAE1; Sun, 24 Nov 2024 01:36:03 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 00C2A1600110; Sun, 24 Nov 2024 01:36:02 +0530 (IST) From: Raag Jadav To: gregkh@linuxfoundation.org, linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.dev Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-sound@vger.kernel.org, Raag Jadav Subject: [PATCH v1 2/5] pinctrl: intel: copy communities using devm_kmemdup_array() Date: Sun, 24 Nov 2024 01:35:24 +0530 Message-Id: <20241123200527.7830-3-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241123200527.7830-1-raag.jadav@intel.com> References: <20241123200527.7830-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Copy communities using devm_kmemdup_array() instead of doing it manually. Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-intel.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 04b438f63ccb..e165bd5b5811 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -1577,8 +1577,8 @@ int intel_pinctrl_probe(struct platform_device *pdev, * to the registers. */ pctrl->ncommunities = pctrl->soc->ncommunities; - pctrl->communities = devm_kcalloc(dev, pctrl->ncommunities, - sizeof(*pctrl->communities), GFP_KERNEL); + pctrl->communities = devm_kmemdup_array(dev, pctrl->soc->communities, pctrl->ncommunities, + sizeof(*pctrl->communities), GFP_KERNEL); if (!pctrl->communities) return -ENOMEM; @@ -1588,8 +1588,6 @@ int intel_pinctrl_probe(struct platform_device *pdev, u32 offset; u32 value; - *community = pctrl->soc->communities[i]; - regs = devm_platform_ioremap_resource(pdev, community->barno); if (IS_ERR(regs)) return PTR_ERR(regs); From patchwork Sat Nov 23 20:05:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 845276 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86B4D1A01C3; Sat, 23 Nov 2024 20:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392371; cv=none; b=h9xBU53efX6JLYzQVhCgQj7TgINyvLxbF/GPMX0PrF8eZDCBYSrAH6q2D+628p1NyqBhuqtVjygq+zInFmQwgQTbcFbTAIh2ghdNfBVzdJyDjk5Y/XHtisST3y19aGoMBmSjL5Pw62wuj6CHd5jO9d7yeqNq49tSE0MvOw6vlYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392371; c=relaxed/simple; bh=UMESgxlu6dg0rI3zXwf63L7oJ9xxwpAQqZvdoZhqkuE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uxRgGBhSSsgltyd++OcAPwDnkj6XhUL7g8/H/ClaWtUfpnivgjsO1ad+AnTP4Jjp0u7vwXoQEXW1wgraPtiDBxDprOeoBlLIltXuwdFAMa+YWQT+N+SH1sRaXbP84WWS814GPnlfsqEYbWU5KvH1P/i2pl/vPQ70nAHBCrH7b7Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Aj55+Kd4; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Aj55+Kd4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732392371; x=1763928371; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UMESgxlu6dg0rI3zXwf63L7oJ9xxwpAQqZvdoZhqkuE=; b=Aj55+Kd49uICQjzQE/NFBf9543qGeMZyxxAeDi7ZC+rMN0JbVYRt0az+ eIjx1+tzvW6qoKA7DnpB2ZPEtV0DrnWK5rObEyLkKpY0/bY0VgylVT9Pc NgvEZjOmZpvWK3hLYo4aZwY30Us7vUpMPht1b5Zkbt0MIYzrZdtwCWmdw TeEE82/QCSc9GjmSjSkJ+BL0OzBwOHH2V8eFf3YtO+9GLv9CnxX3hAC4Z ren7XEYQnq/N6uhtoI0XIl2qYHrJuhpKjpTi9BVhNl2TxY3chWJi+2mTl cVmdQcbekQxeXvX57xm8TxCEy6IegAcXY1eSOk4c/8BcGkPIix/KTPP95 g==; X-CSE-ConnectionGUID: 9DSFbN9rSu+7UoJ/NbVHXA== X-CSE-MsgGUID: yYlWtD7MT1yJ5m4k/1Qdqg== X-IronPort-AV: E=McAfee;i="6700,10204,11265"; a="32678554" X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="32678554" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2024 12:06:07 -0800 X-CSE-ConnectionGUID: cF0Xm40AQsKReCrd/Ya44g== X-CSE-MsgGUID: A86QlW7bSmCKzpfbE+boTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="121737996" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by orviesa002.jf.intel.com with ESMTP; 23 Nov 2024 12:06:04 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 189B31CADA; Sun, 24 Nov 2024 01:36:03 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 03BBA160010D; Sun, 24 Nov 2024 01:36:03 +0530 (IST) From: Raag Jadav To: gregkh@linuxfoundation.org, linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.dev Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-sound@vger.kernel.org, Raag Jadav Subject: [PATCH v1 3/5] pinctrl: pxa2xx: use devm_kmemdup_array() Date: Sun, 24 Nov 2024 01:35:25 +0530 Message-Id: <20241123200527.7830-4-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241123200527.7830-1-raag.jadav@intel.com> References: <20241123200527.7830-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert to use devm_kmemdup_array() which is more robust. Signed-off-by: Raag Jadav --- drivers/pinctrl/pxa/pinctrl-pxa2xx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c index 9e34b92ff5f2..9fd7a8fb2bc4 100644 --- a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c +++ b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c @@ -281,9 +281,8 @@ static int pxa2xx_build_functions(struct pxa_pinctrl *pctl) for (df = pctl->ppins[i].functions; df->name; df++) if (!pxa2xx_find_function(pctl, df->name, functions)) (functions + pctl->nfuncs++)->name = df->name; - pctl->functions = devm_kmemdup(pctl->dev, functions, - pctl->nfuncs * sizeof(*functions), - GFP_KERNEL); + pctl->functions = devm_kmemdup_array(pctl->dev, functions, pctl->nfuncs, + sizeof(*functions), GFP_KERNEL); if (!pctl->functions) return -ENOMEM; @@ -314,7 +313,8 @@ static int pxa2xx_build_groups(struct pxa_pinctrl *pctl) pctl->ppins[j].pin.name; func = pctl->functions + i; func->ngroups = ngroups; - func->groups = devm_kmemdup(pctl->dev, gtmp, ngroups * sizeof(*gtmp), GFP_KERNEL); + func->groups = devm_kmemdup_array(pctl->dev, gtmp, ngroups, + sizeof(*gtmp), GFP_KERNEL); if (!func->groups) return -ENOMEM; } From patchwork Sat Nov 23 20:05:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 845277 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08E77183CC9; Sat, 23 Nov 2024 20:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392370; cv=none; b=FvALF4nflgJgprHkUJQ2Ymc/oesc7OlbbR7zzLmBzliiAXYOkV4mV5OnlTgexhH0vpyRWB+14kkpf60dhph0arGcFKNCxEG7+Zvt1vnCvmqG9NAXwstX8dhsNVUBAX8F8y6vLSrDSbOiy9ya6tQIgncPzc+wUR8ZONVTlkYmg/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392370; c=relaxed/simple; bh=3EIXoatjneQZ2uqGx9N3SU/Mn6t64EkwXr6y2DKjDv4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mR7FTGJeyJTU4AyktquVPxZJmYT77gQzs3HBa6DAvSRdAGRPbW7JldV1yO2rWiGV3I3QFlFOWUszoi7ovWQtqUKbQQSlQSbhOvW/cSuRcIR52dQAgKzZGRzXth0J9MaKSwqzeL9dvuDwiCQGG7SXecAB32VAsvEpg888cgjXY6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=d3WdZ3T8; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="d3WdZ3T8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732392370; x=1763928370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3EIXoatjneQZ2uqGx9N3SU/Mn6t64EkwXr6y2DKjDv4=; b=d3WdZ3T82aQnm1IdFL+vD61j5cI2YqaykV5SqH13kDqpf9kYH0IY29gg J/DhlKms3zPWG9u5dnPAW3yAD+SFIlZXjIlPk+5b+heNCKKcXEoClgD+s yFOD+4byeQfInubLtdOXrlbpkfQtqo32RL3kLK3fKFE0gy3lhJL2zV1wp roKhKR3sLastRa3Wluitef2ncFdwvGuhXfAlumug0XD7nx7+IbPlNipe1 flrwDszgADN8wJ5XWlQstUztOEPEJpgLLonB0nnI9dxyErYNeHtl9yi6V dqnSle11rdTZCV2nBExexy9gZhCAneBElMamhPPVd/oPThGLu0feWtV7Z w==; X-CSE-ConnectionGUID: pB+r6qeNTqqJpQpMjc2n6g== X-CSE-MsgGUID: g8sUBcUpSAqrCw47ZiDoLQ== X-IronPort-AV: E=McAfee;i="6700,10204,11265"; a="32678548" X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="32678548" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2024 12:06:07 -0800 X-CSE-ConnectionGUID: j1wCi1s3QPCJMqEasbxWgQ== X-CSE-MsgGUID: zUYzynniTPOxLP4muEDOhQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="121737994" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by orviesa002.jf.intel.com with ESMTP; 23 Nov 2024 12:06:04 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 0E4191CAD9; Sun, 24 Nov 2024 01:36:03 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 06A141600111; Sun, 24 Nov 2024 01:36:03 +0530 (IST) From: Raag Jadav To: gregkh@linuxfoundation.org, linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.dev Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-sound@vger.kernel.org, Raag Jadav Subject: [PATCH v1 4/5] input: sparse-keymap: use devm_kmemdup_array() Date: Sun, 24 Nov 2024 01:35:26 +0530 Message-Id: <20241123200527.7830-5-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241123200527.7830-1-raag.jadav@intel.com> References: <20241123200527.7830-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert to use devm_kmemdup_array() which is more robust. Signed-off-by: Raag Jadav --- drivers/input/sparse-keymap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c index 25bf8be6e711..5ec3b9ebcac5 100644 --- a/drivers/input/sparse-keymap.c +++ b/drivers/input/sparse-keymap.c @@ -176,8 +176,7 @@ int sparse_keymap_setup(struct input_dev *dev, for (e = keymap; e->type != KE_END; e++) map_size++; - map = devm_kmemdup(&dev->dev, keymap, map_size * sizeof(*map), - GFP_KERNEL); + map = devm_kmemdup_array(&dev->dev, keymap, map_size, sizeof(*map), GFP_KERNEL); if (!map) return -ENOMEM; From patchwork Sat Nov 23 20:05:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 845275 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5A3B1A3047; Sat, 23 Nov 2024 20:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392372; cv=none; b=VlXALqQknh5wHXVU3b14WFgrUagDvxUCOeznXYZpwlpHAyx3TX1msyXojptTV0yhWEnygXIYbe4V7hGcylCqpRwPRrIXhuxw9Ra/zmEn3KuuSuqsMErAOXUBbxyvUTiq5knUR73L24NSv5KXcawzAViXJIXxr/KazoiMiG5CCM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732392372; c=relaxed/simple; bh=++FE/7iFKI7NjgLLAi5nkL/mj98q5NwZkvRUtGH5+AI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UyDBPO5/MuoTQOKKfvz1HxO4QwFL5ED/lM2Q0BtFAK2oG5DCF15vp2MgkLxr5HQ7ijqW6bnKVAZby2ft050q8BZ5YpwDxq5zkXw9Rj60wQDJHe8LBfc6mPBNLD5LmsKAb/HM0baLKsw6Lgki3xQ21MmiYj01M/JF2YfWtqQxz6A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YZWzLDo4; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YZWzLDo4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732392371; x=1763928371; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=++FE/7iFKI7NjgLLAi5nkL/mj98q5NwZkvRUtGH5+AI=; b=YZWzLDo4uznLcATZqS+bKSNvfmTF9y9dqC1W5P5c8QRX12qx2wa99toT DfVvHqer4npjxll+SMWo5StTcyQhkIR5ER06Ic4eU2lKRrnFiiRN8H+Ab 9a3Ho3JwWjCQxWa6afBINO2sGGRQnMD59ZBnwVD93zCgSDdkD9WWv0FRh Zsv2WekRt8X3RBMrXwaCacelSp2R9CY7PQMBs85J8ZOB3l2miLoNIK8xN 68+gBMjMXoyKByThd9Y/HBSDXF59XltRZYt04Hbku9DcRB6jwpVKxvoQa GWS4/E8V3OmxiQYB1/IOtZ6+zL7EmS+UZqRJUurE3rmfXoHHZiB9XepEY g==; X-CSE-ConnectionGUID: jSn91T7fSdyScDwBrtcbCw== X-CSE-MsgGUID: PGmtXOudRT6nLqxOI3T0rA== X-IronPort-AV: E=McAfee;i="6700,10204,11265"; a="32678557" X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="32678557" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2024 12:06:08 -0800 X-CSE-ConnectionGUID: fhU+mkJvQ5CJ+KPPPODyZw== X-CSE-MsgGUID: kOVrtAkcT9erutaGHfsrNg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,179,1728975600"; d="scan'208";a="121737998" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by orviesa002.jf.intel.com with ESMTP; 23 Nov 2024 12:06:04 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 2428D1CADC; Sun, 24 Nov 2024 01:36:03 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 098431600112; Sun, 24 Nov 2024 01:36:03 +0530 (IST) From: Raag Jadav To: gregkh@linuxfoundation.org, linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.dev Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-sound@vger.kernel.org, Raag Jadav Subject: [PATCH v1 5/5] ASoC: Intel: avs: use devm_kmemdup_array() Date: Sun, 24 Nov 2024 01:35:27 +0530 Message-Id: <20241123200527.7830-6-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241123200527.7830-1-raag.jadav@intel.com> References: <20241123200527.7830-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert to use devm_kmemdup_array() which is more robust. Signed-off-by: Raag Jadav Acked-by: Mark Brown --- sound/soc/intel/avs/boards/da7219.c | 3 ++- sound/soc/intel/avs/boards/es8336.c | 3 ++- sound/soc/intel/avs/boards/nau8825.c | 3 ++- sound/soc/intel/avs/boards/rt274.c | 3 ++- sound/soc/intel/avs/boards/rt286.c | 3 ++- sound/soc/intel/avs/boards/rt298.c | 3 ++- sound/soc/intel/avs/boards/rt5663.c | 3 ++- sound/soc/intel/avs/boards/rt5682.c | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/sound/soc/intel/avs/boards/da7219.c b/sound/soc/intel/avs/boards/da7219.c index 80c0a1a95654..1b8f58b611a4 100644 --- a/sound/soc/intel/avs/boards/da7219.c +++ b/sound/soc/intel/avs/boards/da7219.c @@ -113,7 +113,8 @@ static int avs_da7219_codec_init(struct snd_soc_pcm_runtime *runtime) } num_pins = ARRAY_SIZE(card_headset_pins); - pins = devm_kmemdup(card->dev, card_headset_pins, sizeof(*pins) * num_pins, GFP_KERNEL); + pins = devm_kmemdup_array(card->dev, card_headset_pins, num_pins, + sizeof(*pins), GFP_KERNEL); if (!pins) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/es8336.c b/sound/soc/intel/avs/boards/es8336.c index c8522e2430f8..8103e539e08a 100644 --- a/sound/soc/intel/avs/boards/es8336.c +++ b/sound/soc/intel/avs/boards/es8336.c @@ -109,7 +109,8 @@ static int avs_es8336_codec_init(struct snd_soc_pcm_runtime *runtime) data = snd_soc_card_get_drvdata(card); num_pins = ARRAY_SIZE(card_headset_pins); - pins = devm_kmemdup(card->dev, card_headset_pins, sizeof(*pins) * num_pins, GFP_KERNEL); + pins = devm_kmemdup_array(card->dev, card_headset_pins, num_pins, + sizeof(*pins), GFP_KERNEL); if (!pins) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/nau8825.c b/sound/soc/intel/avs/boards/nau8825.c index 6ea9058fdb2a..0945a539b364 100644 --- a/sound/soc/intel/avs/boards/nau8825.c +++ b/sound/soc/intel/avs/boards/nau8825.c @@ -88,7 +88,8 @@ static int avs_nau8825_codec_init(struct snd_soc_pcm_runtime *runtime) jack = snd_soc_card_get_drvdata(card); num_pins = ARRAY_SIZE(card_headset_pins); - pins = devm_kmemdup(card->dev, card_headset_pins, sizeof(*pins) * num_pins, GFP_KERNEL); + pins = devm_kmemdup_array(card->dev, card_headset_pins, num_pins, + sizeof(*pins), GFP_KERNEL); if (!pins) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt274.c b/sound/soc/intel/avs/boards/rt274.c index 9fcce86c6eb4..bdf36c7c744a 100644 --- a/sound/soc/intel/avs/boards/rt274.c +++ b/sound/soc/intel/avs/boards/rt274.c @@ -98,7 +98,8 @@ static int avs_rt274_codec_init(struct snd_soc_pcm_runtime *runtime) jack = snd_soc_card_get_drvdata(card); num_pins = ARRAY_SIZE(card_headset_pins); - pins = devm_kmemdup(card->dev, card_headset_pins, sizeof(*pins) * num_pins, GFP_KERNEL); + pins = devm_kmemdup_array(card->dev, card_headset_pins, num_pins, + sizeof(*pins), GFP_KERNEL); if (!pins) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt286.c b/sound/soc/intel/avs/boards/rt286.c index f157f2d19efb..f94382389430 100644 --- a/sound/soc/intel/avs/boards/rt286.c +++ b/sound/soc/intel/avs/boards/rt286.c @@ -59,7 +59,8 @@ static int avs_rt286_codec_init(struct snd_soc_pcm_runtime *runtime) jack = snd_soc_card_get_drvdata(card); num_pins = ARRAY_SIZE(card_headset_pins); - pins = devm_kmemdup(card->dev, card_headset_pins, sizeof(*pins) * num_pins, GFP_KERNEL); + pins = devm_kmemdup_array(card->dev, card_headset_pins, num_pins, + sizeof(*pins), GFP_KERNEL); if (!pins) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt298.c b/sound/soc/intel/avs/boards/rt298.c index 1e85242c8dd2..985bfa977edb 100644 --- a/sound/soc/intel/avs/boards/rt298.c +++ b/sound/soc/intel/avs/boards/rt298.c @@ -70,7 +70,8 @@ static int avs_rt298_codec_init(struct snd_soc_pcm_runtime *runtime) jack = snd_soc_card_get_drvdata(card); num_pins = ARRAY_SIZE(card_headset_pins); - pins = devm_kmemdup(card->dev, card_headset_pins, sizeof(*pins) * num_pins, GFP_KERNEL); + pins = devm_kmemdup_array(card->dev, card_headset_pins, num_pins, + sizeof(*pins), GFP_KERNEL); if (!pins) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt5663.c b/sound/soc/intel/avs/boards/rt5663.c index 44f857e90969..fd8b0c915efa 100644 --- a/sound/soc/intel/avs/boards/rt5663.c +++ b/sound/soc/intel/avs/boards/rt5663.c @@ -65,7 +65,8 @@ static int avs_rt5663_codec_init(struct snd_soc_pcm_runtime *runtime) jack = &priv->jack; num_pins = ARRAY_SIZE(card_headset_pins); - pins = devm_kmemdup(card->dev, card_headset_pins, sizeof(*pins) * num_pins, GFP_KERNEL); + pins = devm_kmemdup_array(card->dev, card_headset_pins, num_pins, + sizeof(*pins), GFP_KERNEL); if (!pins) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt5682.c b/sound/soc/intel/avs/boards/rt5682.c index 0dcc6392a0cc..6d7022707ca7 100644 --- a/sound/soc/intel/avs/boards/rt5682.c +++ b/sound/soc/intel/avs/boards/rt5682.c @@ -102,7 +102,7 @@ static int avs_rt5682_codec_init(struct snd_soc_pcm_runtime *runtime) jack = snd_soc_card_get_drvdata(card); num_pins = ARRAY_SIZE(card_jack_pins); - pins = devm_kmemdup(card->dev, card_jack_pins, sizeof(*pins) * num_pins, GFP_KERNEL); + pins = devm_kmemdup_array(card->dev, card_jack_pins, num_pins, sizeof(*pins), GFP_KERNEL); if (!pins) return -ENOMEM;