[PATCH] fs/fat: Initialize local variable finfo

franck.jullien at gmail.com franck.jullien at gmail.com
Tue Nov 15 17:46:28 EST 2011


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.

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




More information about the barebox mailing list