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] [day] [month] [year] [list]
Message-ID: <20170817145751.2715eba4@bbrezillon>
Date:   Thu, 17 Aug 2017 14:57:51 +0200
From:   Boris Brezillon <boris.brezillon@...e-electrons.com>
To:     "Gustavo A. R. Silva" <garsilva@...eddedor.com>
Cc:     David Woodhouse <dwmw2@...radead.org>,
        Brian Norris <computersforpeace@...il.com>,
        Marek Vasut <marek.vasut@...il.com>,
        Richard Weinberger <richard@....at>,
        Cyrille Pitchen <cyrille.pitchen@...ev4u.fr>,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtd: spear_smi: add NULL check on devm_kzalloc() return
 value

Le Thu, 6 Jul 2017 17:25:50 -0500,
"Gustavo A. R. Silva" <garsilva@...eddedor.com> a écrit :

> Check return value from call to devm_kzalloc()
> in order to prevent a NULL pointer dereference.
> 
> This issue was detected using Coccinelle and the following semantic patch:
> 
> @@
> expression x;
> identifier fld;
> @@
> 
> * x = devm_kzalloc(...);
>   ... when != x == NULL
>   x->fld
> 

Applied to l2-mtd/master.

Thanks,

Boris

> Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>
> ---
>  drivers/mtd/devices/spear_smi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c
> index dd50698..ddf4789 100644
> --- a/drivers/mtd/devices/spear_smi.c
> +++ b/drivers/mtd/devices/spear_smi.c
> @@ -775,6 +775,8 @@ static int spear_smi_probe_config_dt(struct platform_device *pdev,
>  	pdata->board_flash_info = devm_kzalloc(&pdev->dev,
>  					       sizeof(*pdata->board_flash_info),
>  					       GFP_KERNEL);
> +	if (!pdata->board_flash_info)
> +		return -ENOMEM;
>  
>  	/* Fill structs for each subnode (flash device) */
>  	while ((pp = of_get_next_child(np, pp))) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ