[U-Boot] [PATCH 3/3] ext4: correctly zero filename

Jeroen Hofstee jeroen at myspectrum.nl
Mon Jun 9 15:29:00 CEST 2014


Since ALLOC_CACHE_ALIGN_BUFFER declares a char* for filename
sizeof(filename) is not the size of the buffer. Use the already
known length instead.

cc: Uma Shankar <uma.shankar at samsung.com>
cc: Manjunatha C Achar <a.manjunatha at samsung.com>
cc: Marek Vasut <marek.vasut at gmail.com>
Signed-off-by: Jeroen Hofstee <jeroen at myspectrum.nl>
---
 fs/ext4/ext4_write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c
index c42add9..648a596 100644
--- a/fs/ext4/ext4_write.c
+++ b/fs/ext4/ext4_write.c
@@ -840,7 +840,7 @@ int ext4fs_write(const char *fname, unsigned char *buffer,
 	unsigned int ibmap_idx;
 	struct ext_filesystem *fs = get_fs();
 	ALLOC_CACHE_ALIGN_BUFFER(char, filename, 256);
-	memset(filename, 0x00, sizeof(filename));
+	memset(filename, 0x00, 256);
 
 	g_parent_inode = zalloc(sizeof(struct ext2_inode));
 	if (!g_parent_inode)
-- 
1.8.3.2



More information about the U-Boot mailing list