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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 1 Oct 2021 09:14:58 +0200
From:   Amelie DELAUNAY <amelie.delaunay@...s.st.com>
To:     "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Vinod Koul <vkoul@...nel.org>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>
CC:     <dmaengine@...r.kernel.org>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <linux-hardening@...r.kernel.org>
Subject: Re: [PATCH][next] dmaengine: stm32-mdma: Use struct_size() helper in
 devm_kzalloc()



On 9/30/21 12:29 AM, Gustavo A. R. Silva wrote:
> Make use of the struct_size() helper instead of an open-coded version,
> in order to avoid any potential type mistakes or integer overflows that,
> in the worse scenario, could lead to heap overflows.
> 
> Link: https://github.com/KSPP/linux/issues/160
> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>

Reviewed-by: Amelie Delaunay <amelie.delaunay@...s.st.com>

> ---
>   drivers/dma/stm32-mdma.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
> index 18cbd1e43c2e..d30a4a28d3bf 100644
> --- a/drivers/dma/stm32-mdma.c
> +++ b/drivers/dma/stm32-mdma.c
> @@ -1566,7 +1566,8 @@ static int stm32_mdma_probe(struct platform_device *pdev)
>   	if (count < 0)
>   		count = 0;
>   
> -	dmadev = devm_kzalloc(&pdev->dev, sizeof(*dmadev) + sizeof(u32) * count,
> +	dmadev = devm_kzalloc(&pdev->dev,
> +			      struct_size(dmadev, ahb_addr_masks, count),
>   			      GFP_KERNEL);
>   	if (!dmadev)
>   		return -ENOMEM;
> 

Powered by blists - more mailing lists