Re: [PATCH 4/5] ubifs: fix potential NULL ptr dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 06, 2016 at 09:32:51PM +0200, Lucas Stach wrote:
> Signed-off-by: Lucas Stach <dev@xxxxxxxxxx>
> ---
>  fs/ubifs/ubifs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
> index 8062baa..bc1b521 100644
> --- a/fs/ubifs/ubifs.c
> +++ b/fs/ubifs/ubifs.c
> @@ -479,7 +479,7 @@ out:
>  		dbg_gen("cannot find next direntry, error %d", err);
>  
>  out_free:
> -	if (file->private_data)
> +	if (file && file->private_data)
>  		kfree(file->private_data);
>  	if (file)
>  		free(file);

We should rather use xzalloc, then we could drop all the if() in the
error path.

Sascha

-- 
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 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux