[PATCH] fs/fat: Initialize local variable finfo

Sascha Hauer s.hauer at pengutronix.de
Thu Nov 17 11:00:20 EST 2011


On Tue, Nov 15, 2011 at 11:46:28PM +0100, franck.jullien at gmail.com wrote:
> From: Franck Jullien <franck.jullien at gmail.com>
> 
> fat_stat in fs/fat.c declares finfo but doesn't initialize it.
> When get_fileinfo is called, fno->lfname and fno->lfsize are
> tested but haven't been zeroed...This can lead to a wrong
> behavior.

Applied to -master.

Thanks
 Sascha

> 
> Signed-off-by: Franck Jullien <franck.jullien at gmail.com>
> ---
>  fs/fat/fat.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
> index 4219801..8420f3a 100644
> --- a/fs/fat/fat.c
> +++ b/fs/fat/fat.c
> @@ -354,6 +354,8 @@ static int fat_stat(struct device_d *dev, const char *filename, struct stat *s)
>  	FILINFO finfo;
>  	int ret;
>  
> +	memset(&finfo, 0, sizeof(FILINFO));
> +
>  	ret = f_stat(&priv->fat, filename, &finfo);
>  	if (ret)
>  		return ret;
> -- 
> 1.7.7
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

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