You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/04/07 18:45:12 UTC

[38/50] [abbrv] incubator-mynewt-core git commit: MYNEWT-709 nffs - Occasional unit test failures

MYNEWT-709 nffs - Occasional unit test failures

Fix some more issues reported by valgrind.

Hopefully this fixes the occasional test failures.  Valgrind doesn't
report any more issues except for the stack switch message that all sim
apps elicit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/bcaf2ff5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/bcaf2ff5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/bcaf2ff5

Branch: refs/heads/master
Commit: bcaf2ff5f31f560ad47b8ae209451c8aa48efb3a
Parents: eea7f7c
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Apr 5 12:03:27 2017 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Apr 5 12:04:51 2017 -0700

----------------------------------------------------------------------
 fs/nffs/src/nffs_block.c                       | 2 ++
 fs/nffs/src/nffs_inode.c                       | 2 ++
 fs/nffs/test/src/nffs_test_utils.c             | 6 +++++-
 fs/nffs/test/src/testcases/large_unlink_test.c | 9 +++++++--
 4 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bcaf2ff5/fs/nffs/src/nffs_block.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_block.c b/fs/nffs/src/nffs_block.c
index 30b6616..f7d5847 100644
--- a/fs/nffs/src/nffs_block.c
+++ b/fs/nffs/src/nffs_block.c
@@ -342,6 +342,8 @@ nffs_block_from_hash_entry_no_ptrs(struct nffs_block *out_block,
 
     assert(nffs_hash_id_is_block(block_entry->nhe_id));
 
+    memset(out_block, 0, sizeof *out_block);
+
     if (nffs_hash_entry_is_dummy(block_entry)) {
         /*
          * We can't read this from disk so we'll be missing filling in anything

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bcaf2ff5/fs/nffs/src/nffs_inode.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_inode.c b/fs/nffs/src/nffs_inode.c
index 2b38ab9..90285ce 100644
--- a/fs/nffs/src/nffs_inode.c
+++ b/fs/nffs/src/nffs_inode.c
@@ -202,6 +202,8 @@ nffs_inode_from_entry(struct nffs_inode *out_inode,
     int cached_name_len;
     int rc;
 
+    memset(out_inode, 0, sizeof *out_inode);
+
     if (nffs_inode_is_dummy(entry)) {
         nffs_inode_restore_from_dummy_entry(out_inode, entry);
         return FS_ENOENT;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bcaf2ff5/fs/nffs/test/src/nffs_test_utils.c
----------------------------------------------------------------------
diff --git a/fs/nffs/test/src/nffs_test_utils.c b/fs/nffs/test/src/nffs_test_utils.c
index 44382d0..fea07b8 100644
--- a/fs/nffs/test/src/nffs_test_utils.c
+++ b/fs/nffs/test/src/nffs_test_utils.c
@@ -54,7 +54,11 @@ void
 nffs_test_util_assert_ent_name(struct fs_dirent *dirent,
                                const char *expected_name)
 {
-    char name[NFFS_FILENAME_MAX_LEN + 1];
+    /* It should not be necessary to initialize this array, but the libgcc
+     * version of strcmp triggers a "Conditional jump or move depends on
+     * uninitialised value(s)" valgrind warning.
+     */
+    char name[NFFS_FILENAME_MAX_LEN + 1] = { 0 };
     uint8_t name_len;
     int rc;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bcaf2ff5/fs/nffs/test/src/testcases/large_unlink_test.c
----------------------------------------------------------------------
diff --git a/fs/nffs/test/src/testcases/large_unlink_test.c b/fs/nffs/test/src/testcases/large_unlink_test.c
index 7da7c15..4805ff4 100644
--- a/fs/nffs/test/src/testcases/large_unlink_test.c
+++ b/fs/nffs/test/src/testcases/large_unlink_test.c
@@ -21,13 +21,18 @@
 
 TEST_CASE(nffs_test_large_unlink)
 {
-    static char file_contents[1024 * 4];
-    char filename[256];
+    /* It should not be necessary to initialize this array, but the libgcc
+     * version of strcmp triggers a "Conditional jump or move depends on
+     * uninitialised value(s)" valgrind warning.
+     */
+    char filename[256] = { 0 };
     int rc;
     int i;
     int j;
     int k;
 
+    static char file_contents[1024 * 4];
+
     /*** Setup. */
     nffs_config.nc_num_inodes = 1024;
     nffs_config.nc_num_blocks = 1024;