lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 3 Jan 2019 12:00:09 +0100
From:   Michal Simek <michal.simek@...inx.com>
To:     "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        Jolly Shah <jolly.shah@...inx.com>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Michal Simek <michal.simek@...inx.com>
CC:     <linux-clk@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] clk: zynqmp: Fix memory allocation in zynqmp_clk_setup

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@...r.kernel.org
> Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.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@...inx.com>

Thanks,
Michal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ