coreutils
[Top][All Lists]
Advanced

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

[PATCH] df: fix use of uninitialized variable reported by valgrind


From: Pádraig Brady
Subject: [PATCH] df: fix use of uninitialized variable reported by valgrind
Date: Thu, 2 Apr 2015 05:37:13 +0100

 Conditional jump or move depends on uninitialised value(s)
    at 0x40380C: get_field_values (df.c:840)
    by 0x403E16: get_dev (df.c:994)
    by 0x404D65: get_all_entries (df.c:1364)
    by 0x405926: main (df.c:1714)

* src/df.c (get_dev): Initialize the fsu.fsu_bavail_top_bit_set
member, when adding placeholder entries.
---
 src/df.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/df.c b/src/df.c
index 76a3e37..4eda393 100644
--- a/src/df.c
+++ b/src/df.c
@@ -925,6 +925,7 @@ get_dev (char const *disk, char const *mount_point, char 
const* file,
             return;
 
           fstype = "-";
+          fsu.fsu_bavail_top_bit_set = false;
           fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree =
           fsu.fsu_bavail = fsu.fsu_files = fsu.fsu_ffree = UINTMAX_MAX;
         }
@@ -949,6 +950,7 @@ get_dev (char const *disk, char const *mount_point, char 
const* file,
               && (! dev_me->me_remote || ! me_remote))
             {
               fstype = "-";
+              fsu.fsu_bavail_top_bit_set = false;
               fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree =
               fsu.fsu_bavail = fsu.fsu_files = fsu.fsu_ffree = UINTMAX_MAX;
             }
-- 
2.1.0




reply via email to

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