package/exfatprogs: fix compile failure node may be used uninitialized
authorPeter Seiderer <ps.report@gmx.net>
Sat, 9 May 2020 16:21:15 +0000 (18:21 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 9 May 2020 20:41:44 +0000 (22:41 +0200)
Fixes:

  - http://autobuild.buildroot.net/results/5c5/5c5d71fde80a4f2f027085bdb0fae9fb76ab9d32

  fsck.c:1062:18: error: 'node' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       node->parent = dir;
                    ^
  fsck.c:870:22: note: 'node' was declared here
    struct exfat_inode *node;
                        ^

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/exfatprogs/0003-fsck-fix-node-may-be-used-uninitialized.patch [new file with mode: 0644]

diff --git a/package/exfatprogs/0003-fsck-fix-node-may-be-used-uninitialized.patch b/package/exfatprogs/0003-fsck-fix-node-may-be-used-uninitialized.patch
new file mode 100644 (file)
index 0000000..b62aaf3
--- /dev/null
@@ -0,0 +1,63 @@
+From 1b0a48ef0aa33a4f5b9c8d23d9f647482d0f28dd Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report@gmx.net>
+Date: Sat, 9 May 2020 15:05:46 +0200
+Subject: [PATCH] fsck: fix node may be used uninitialized
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The complicated way of gcc to tell not all failure pathes
+set a return value != 0 in the calls before.
+
+Fixes:
+
+  fsck.c:1063:18: error: ‘node’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+       node->parent = dir;
+                    ^
+  fsck.c:871:22: note: ‘node’ was declared here
+    struct exfat_inode *node;
+                        ^
+[Upstream: https://github.com/exfatprogs/exfatprogs/pull/92]
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ fsck/fsck.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/fsck/fsck.c b/fsck/fsck.c
+index 67d7946..f0daa1d 100644
+--- a/fsck/fsck.c
++++ b/fsck/fsck.c
+@@ -801,12 +801,12 @@ static int read_file_dentries(struct exfat_de_iter *iter,
+       ret = exfat_de_iter_get(iter, 0, &file_de);
+       if (ret || file_de->type != EXFAT_FILE) {
+               exfat_err("failed to get file dentry. %d\n", ret);
+-              return ret;
++              return -EINVAL;
+       }
+       ret = exfat_de_iter_get(iter, 1, &stream_de);
+       if (ret || stream_de->type != EXFAT_STREAM) {
+               exfat_err("failed to get stream dentry. %d\n", ret);
+-              return ret;
++              return -EINVAL;
+       }
+       *new_node = NULL;
+@@ -825,6 +825,7 @@ static int read_file_dentries(struct exfat_de_iter *iter,
+               ret = exfat_de_iter_get(iter, i, &name_de);
+               if (ret || name_de->type != EXFAT_NAME) {
+                       exfat_err("failed to get name dentry. %d\n", ret);
++                      ret = -EINVAL;
+                       goto err;
+               }
+@@ -852,6 +853,7 @@ static int read_file_dentries(struct exfat_de_iter *iter,
+               exfat_err("valid size %" PRIu64 " greater than size %llu: %s\n",
+                       le64_to_cpu(stream_de->stream_valid_size), node->size,
+                       path_resolve_ctx.local_path);
++              ret = -EINVAL;
+               goto err;
+       }
+-- 
+2.26.2
+