From: Michal Simek <michal.simek@xilinx.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Jolly Shah <jolly.shah@xilinx.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Michal Simek <michal.simek@xilinx.com>
Cc: <linux-clk@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] clk: zynqmp: Fix memory allocation in zynqmp_clk_setup
Date: Thu, 3 Jan 2019 12:00:09 +0100 [thread overview]
Message-ID: <8d281c7b-4d07-02a3-fd89-61eeeaa78612@xilinx.com> (raw)
In-Reply-To: <20181224055058.GA23947@embeddedor.com>
On 24. 12. 18 6:50, Gustavo A. R. Silva wrote:
> Fix memory allocation and use struct_size() in kzalloc().
>
> Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> drivers/clk/zynqmp/clkc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
> index f65cc0ff76ab..b0908ec62f73 100644
> --- a/drivers/clk/zynqmp/clkc.c
> +++ b/drivers/clk/zynqmp/clkc.c
> @@ -669,8 +669,8 @@ static int zynqmp_clk_setup(struct device_node *np)
> if (ret)
> return ret;
>
> - zynqmp_data = kzalloc(sizeof(*zynqmp_data) + sizeof(*zynqmp_data) *
> - clock_max_idx, GFP_KERNEL);
> + zynqmp_data = kzalloc(struct_size(zynqmp_data, hws, clock_max_idx),
> + GFP_KERNEL);
> if (!zynqmp_data)
> return -ENOMEM;
>
>
Looks good. Description could be maybe more verbose that you are fixing
issue that it should be sizeof(struct clk_hw) instead of sizeof(struct
clk_hw_onecell_data)
Otherwise
Acked-by: Michal Simek <michal.simek@xilinx.com>
Thanks,
Michal
next prev parent reply other threads:[~2019-01-03 11:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-24 5:50 Gustavo A. R. Silva
2019-01-03 11:00 ` Michal Simek [this message]
2019-01-09 18:38 ` Stephen Boyd
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=8d281c7b-4d07-02a3-fd89-61eeeaa78612@xilinx.com \
--to=michal.simek@xilinx.com \
--cc=gustavo@embeddedor.com \
--cc=jolly.shah@xilinx.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/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
all inboxes | Powered by JetHome®