info-mtools
[Top][All Lists]
Advanced

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

[Info-mtools] [PATCH] mmd: avoid uninitialised byte in . and .. director


From: Jonathan Davies
Subject: [Info-mtools] [PATCH] mmd: avoid uninitialised byte in . and .. directory entries
Date: Wed, 16 Feb 2022 16:11:11 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

Hello,

Please find attached a patch that fixes an uninitialised byte when mmd creates . and .. directory entries. This helps make filesystem images deterministic and silences a warning from valgrind.

Here is a sample extract from valgrind output on "mmd -i img ::foo" showing the warning:

==151012== Syscall param write(buf) points to uninitialised byte(s)
==151012==    at 0x513CA90: __write_nocancel (in /usr/lib64/libc-2.17.so)
==151012==    by 0x419F0E: file_io (plain_io.c:100)
==151012==    by 0x40AD7E: force_io (force_io.c:38)
==151012==    by 0x40AD7E: force_write (force_io.c:55)
==151012==    by 0x40358B: _buf_flush (buffer.c:69)
==151012==    by 0x403BD4: buf_flush (buffer.c:309)
==151012==    by 0x41B5E2: flush_stream (stream.c:29)
==151012==    by 0x41B5F2: flush_stream (stream.c:31)
==151012==    by 0x41B5F2: flush_stream (stream.c:31)
==151012==    by 0x41B5F2: flush_stream (stream.c:31)
==151012==    by 0x416A4C: makeit (mmd.c:94)
==151012==    by 0x415C6F: write_slots (mk_direntry.c:494)
==151012==    by 0x415C6F: _mwrite_one (mk_direntry.c:623)
==151012==    by 0x415E55: mwrite_one (mk_direntry.c:655)
==151012==    by 0x416BE3: createDir (mmd.c:133)
==151012==    by 0x416C61: createDirCallback (mmd.c:145)
==151012==    by 0x40C4C6: handle_leaf (mainloop.c:237)
==151012==    by 0x40CCFC: recurs_dos_loop (mainloop.c:351)
==151012==    by 0x40CDE5: common_dos_loop (mainloop.c:454)
==151012==    by 0x40D23D: dos_loop (mainloop.c:467)
==151012==    by 0x40D23D: main_loop (mainloop.c:565)
==151012==    by 0x416D96: mmd (mmd.c:198)
==151012==    by 0x40332F: main (mtools.c:184)
==151012== Address 0x542351c is 22,572 bytes inside a block of size 131,072 alloc'd
==151012==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==151012==    by 0x403C6C: buf_init (buffer.c:364)
==151012==    by 0x40BCF3: fs_init (init.c:377)
==151012==    by 0x41B7D7: open_root_dir (streamcache.c:69)
==151012==    by 0x40CDBF: common_dos_loop (mainloop.c:450)
==151012==    by 0x40D23D: dos_loop (mainloop.c:467)
==151012==    by 0x40D23D: main_loop (mainloop.c:565)
==151012==    by 0x416D96: mmd (mmd.c:198)
==151012==    by 0x40332F: main (mtools.c:184)

Regards,
Jonathan

Attachment: 0001-mmd-avoid-uninitialised-byte-in-.-and-.-directory-en.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]