Whamcloud - gitweb
libext2fs: reset the size of the zeroing buffer
authorAdrien Schildknecht <adriens@google.com>
Wed, 10 Aug 2016 20:43:25 +0000 (16:43 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 10 Aug 2016 20:43:25 +0000 (16:43 -0400)
commit5cc6db0c829353eef4591ac10a9a06c504e65134
tree07b7ac52eb2e971a5dcaac91a8558d09e392b716
parent3d6fc974831a360aee460e54c442538445f3017c
libext2fs: reset the size of the zeroing buffer

When a ext2_filsys is freed, ext2fs_zero_blocks2() frees the buffer but
does not reset its size.
If this function is later called with a new ext2_filsys, the code
assumes that the buffer is still valid and return a NULL pointer.

Valgrind output:
==188948== Syscall param pwrite64(buf) points to unaddressable byte(s)
==188948==    at 0x4E46D03: __pwrite_nocancel (syscall-template.S:81)
==188948==    by 0x1254EC: raw_write_blk (unix_io.c:240)
==188948==    by 0x124AAB: unix_write_blk64 (unix_io.c:850)
==188948==    by 0x122893: ext2fs_zero_blocks2 (mkjournal.c:204)

Signed-off-by: Adrien Schildknecht <adriens@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/mkjournal.c