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]
Message-ID: <20180622002109.0cffb249@bbrezillon>
Date:   Fri, 22 Jun 2018 00:21:09 +0200
From:   Boris Brezillon <boris.brezillon@...tlin.com>
To:     Zhouyang Jia <jiazhouyang09@...il.com>
Cc:     Richard Weinberger <richard@....at>, linux-kernel@...r.kernel.org,
        Marek Vasut <marek.vasut@...il.com>,
        linux-mtd@...ts.infradead.org,
        Brian Norris <computersforpeace@...il.com>,
        David Woodhouse <dwmw2@...radead.org>
Subject: Re: [PATCH] mtd: gpio_flash: add error handling for ioremap_nocache

On Tue, 12 Jun 2018 11:15:00 +0800
Zhouyang Jia <jiazhouyang09@...il.com> wrote:

> When ioremap_nocache fails, the lack of error-handling code may
> cause unexpected results.
> 
> This patch adds error-handling code after calling ioremap_nocache.
> 
> Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
> ---
>  drivers/mtd/maps/gpio-addr-flash.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c
> index 385305e..7fbba02 100644
> --- a/drivers/mtd/maps/gpio-addr-flash.c
> +++ b/drivers/mtd/maps/gpio-addr-flash.c
> @@ -242,6 +242,9 @@ static int gpio_flash_probe(struct platform_device *pdev)
>  	state->map.phys       = NO_XIP;
>  	state->map.map_priv_1 = (unsigned long)state;
>  
> +	if (!state->map.virt)
> +		return -ENOMEM;

Please move the test just after the ioremap_nocache() call. Also, I see
that iounmap() is never called. Probably a good opportunity to switch
to devm_ funcs.

> +
>  	platform_set_drvdata(pdev, state);
>  
>  	i = 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ