From cbe1aa0bd88f076c4feec8662fb0cde8eeb3c6e8 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 26 Aug 2017 13:42:30 -0400 Subject: [PATCH] Silence valgrind warnings Valgrind doesn't understand that the kernel will be initializing the struct termios and struct loop_info64 structures. Since they occur in functions which are not in the hot path, preinitialize to zero to prevent valgrind from producing a huge number of false positives. Signed-off-by: Theodore Ts'o --- e2fsck/util.c | 2 +- lib/ext2fs/ismounted.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2fsck/util.c b/e2fsck/util.c index 43cb7a745..a297e58f1 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -204,7 +204,7 @@ int ask_yn(e2fsck_t ctx, const char * string, int def) static int yes_answers; #ifdef HAVE_TERMIOS_H - struct termios termios, tmp; + struct termios termios = {0, }, tmp; tcgetattr (0, &termios); tmp = termios; diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c index 7d5247155..120299c4f 100644 --- a/lib/ext2fs/ismounted.c +++ b/lib/ext2fs/ismounted.c @@ -66,7 +66,7 @@ static int check_loop_mounted(const char *mnt_fsname, dev_t mnt_rdev, dev_t file_dev, ino_t file_ino) { #if defined(HAVE_LINUX_LOOP_H) && defined(HAVE_LINUX_MAJOR_H) - struct loop_info64 loopinfo; + struct loop_info64 loopinfo = {0, }; int loop_fd, ret; if (major(mnt_rdev) == LOOP_MAJOR) { -- 2.39.2