[PATCH 1/1] cfi_flash: fix NULL pointer dereference

Sascha Hauer s.hauer at pengutronix.de
Fri Feb 28 03:03:50 EST 2014


On Tue, Feb 25, 2014 at 07:05:16PM +0100, Philippe Rétornaz wrote:
> We need to setup the info->dev pointer before flash_get_size() since it
> might use it for dev_dbg().
> This fix a crash on boot when debug output is enabled.
> 
> Signed-off-by: Philippe Rétornaz <philippe.retornaz at epfl.ch>

Applied thanks. Sorry for the delay, this patch was buried in my
mailbox.

Sascha

> ---
>  drivers/mtd/nor/cfi_flash.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
> index 514eab5..3d3d231 100644
> --- a/drivers/mtd/nor/cfi_flash.c
> +++ b/drivers/mtd/nor/cfi_flash.c
> @@ -978,8 +978,8 @@ static int cfi_probe (struct device_d *dev)
>  	info->flash_id = FLASH_UNKNOWN;
>  	info->cmd_reset = FLASH_CMD_RESET;
>  	info->base = dev_request_mem_region(dev, 0);
> -	info->size = flash_get_size(info);
>  	info->dev = dev;
> +	info->size = flash_get_size(info);
>  
>  	if (info->flash_id == FLASH_UNKNOWN) {
>  		dev_warn(dev, "## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n",
> -- 
> 1.7.9.5
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list