From: Krzysztof Kozlowski <krzk@kernel.org>
To: Shen Lichuan <shenlichuan@vivo.com>,
s.nawrocki@samsung.com, linus.walleij@linaro.org
Cc: alim.akhtar@samsung.com, linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
Subject: Re: [PATCH v1] drivers/pinctrl/samsung: Use kmemdup_array instead of kmemdup for multiple allocation
Date: Fri, 23 Aug 2024 10:56:07 +0200 [thread overview]
Message-ID: <fd6b7276-cfb5-41ce-a25d-6278fe4d971e@kernel.org> (raw)
In-Reply-To: <20240823082407.48219-1-shenlichuan@vivo.com>
On 23/08/2024 10:24, Shen Lichuan wrote:
> Let the kememdup_array() take care about
> multiplication and possible overflows.
>
> Using kmemdup_array() is more appropriate
> and makes the code easier to audit.
Please wrap commit message according to Linux coding style / submission
process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597
>
> Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
> ---
> drivers/pinctrl/samsung/pinctrl-samsung.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
> index e4464ee815f9..da24890f27f7 100644
> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> @@ -122,8 +122,8 @@ static int add_map_configs(struct device *dev, struct pinctrl_map **map,
> if (WARN_ON(*num_maps == *reserved_maps))
> return -ENOSPC;
>
> - dup_configs = kmemdup(configs, num_configs * sizeof(*dup_configs),
> - GFP_KERNEL);
> + dup_configs = kmemdup_array(configs, num_configs,
> + sizeof(*dup_configs), GFP_KERNEL);
Misaligned and wrapped too early.
>
Best regards,
Krzysztof
prev parent reply other threads:[~2024-08-23 8:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 8:24 [PATCH v1] drivers/pinctrl/samsung: Use kmemdup_array instead of kmemdup for multiple allocation Shen Lichuan
2024-08-23 8:56 ` Krzysztof Kozlowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fd6b7276-cfb5-41ce-a25d-6278fe4d971e@kernel.org \
--to=krzk@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=s.nawrocki@samsung.com \
--cc=shenlichuan@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).