From 91d2092938449b794d63a019617cff84c58d4bb8 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 20 Apr 2022 14:07:13 +0200 Subject: [PATCH] Add bugfix in GRUB2 squash4 squashfs code (#1830) (#1858) --- ...v-add-file_env-to-load-var-from-file.patch | 8 ++-- ...quash4-Fix-an-uninitialized-variable.patch | 44 +++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 buildroot-external/patches/grub2/0002-squash4-Fix-an-uninitialized-variable.patch diff --git a/buildroot-external/patches/grub2/0001-loadenv-add-file_env-to-load-var-from-file.patch b/buildroot-external/patches/grub2/0001-loadenv-add-file_env-to-load-var-from-file.patch index 83b3819ea..3978e0f5c 100644 --- a/buildroot-external/patches/grub2/0001-loadenv-add-file_env-to-load-var-from-file.patch +++ b/buildroot-external/patches/grub2/0001-loadenv-add-file_env-to-load-var-from-file.patch @@ -1,8 +1,8 @@ -From ee4adaa04e3ac1a5d20ad713a0133382c35da5a1 Mon Sep 17 00:00:00 2001 -Message-Id: +From 184b6a054e04bb4c7fb4885a30d62314229dc551 Mon Sep 17 00:00:00 2001 +Message-Id: <184b6a054e04bb4c7fb4885a30d62314229dc551.1650445464.git.stefan@agner.ch> From: Stefan Agner Date: Thu, 24 Feb 2022 12:38:48 +0100 -Subject: [PATCH] loadenv: add file_env to load var from file +Subject: [PATCH 1/2] loadenv: add file_env to load var from file Introduce file_env which allows to load the value of a variable from a file. The variable value is terminated at the first non-printable @@ -115,5 +115,5 @@ index 3fd664aac..7e7b18139 100644 + grub_unregister_extcmd (cmd_file); } -- -2.35.1 +2.35.3 diff --git a/buildroot-external/patches/grub2/0002-squash4-Fix-an-uninitialized-variable.patch b/buildroot-external/patches/grub2/0002-squash4-Fix-an-uninitialized-variable.patch new file mode 100644 index 000000000..95f7716ad --- /dev/null +++ b/buildroot-external/patches/grub2/0002-squash4-Fix-an-uninitialized-variable.patch @@ -0,0 +1,44 @@ +From 3b2b7d0c9a886d913062ed5a9ffa8b764d882540 Mon Sep 17 00:00:00 2001 +Message-Id: <3b2b7d0c9a886d913062ed5a9ffa8b764d882540.1650445464.git.stefan@agner.ch> +In-Reply-To: <184b6a054e04bb4c7fb4885a30d62314229dc551.1650445464.git.stefan@agner.ch> +References: <184b6a054e04bb4c7fb4885a30d62314229dc551.1650445464.git.stefan@agner.ch> +From: Peter Jones +Date: Mon, 27 Jan 2020 15:01:16 -0500 +Subject: [PATCH 2/2] squash4: Fix an uninitialized variable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +gcc says: + +grub-core/fs/squash4.c: In function ‘direct_read’: +grub-core/fs/squash4.c:868:10: error: ‘err’ may be used uninitialized in +this function [-Werror=maybe-uninitialized] + 868 | if (err) + | ^ +cc1: all warnings being treated as errors + +This patch initializes it to GRUB_ERR_NONE. + +Signed-off-by: Peter Jones +Reviewed-by: Daniel Kiper +--- + grub-core/fs/squash4.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c +index 95d5c1e1f..82704f966 100644 +--- a/grub-core/fs/squash4.c ++++ b/grub-core/fs/squash4.c +@@ -746,7 +746,7 @@ direct_read (struct grub_squash_data *data, + struct grub_squash_cache_inode *ino, + grub_off_t off, char *buf, grub_size_t len) + { +- grub_err_t err; ++ grub_err_t err = GRUB_ERR_NONE; + grub_off_t cumulated_uncompressed_size = 0; + grub_uint64_t a = 0; + grub_size_t i; +-- +2.35.3 +