Accepting request 1080038 from home:michael-chang:branches:Base:System

- Fix the issue of freeing an uninitialized pointer
  * 0002-prep_loadenv-Fix-regex-for-Open-Firmware-device-spec.patch

OBS-URL: https://build.opensuse.org/request/show/1080038
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=450
This commit is contained in:
Michael Chang 2023-04-18 04:58:25 +00:00 committed by Git OBS Bridge
parent ea9c8438f9
commit b08e66a989
2 changed files with 17 additions and 14 deletions

View File

@ -20,13 +20,14 @@ To fix this issue, we have updated the regular expression to properly
handle the encoded comma in the Open Firmware device specifier, ensuring
that the correct boot device is identified and used.
v2:
Fix the issue of freeing an uninitialized pointer in early_prep_loadenv.
Signed-off-by: Michael Chang <mchang@suse.com>
---
grub-core/commands/prep_loadenv.c | 108 ++++++++++++++++++++++--------
1 file changed, 79 insertions(+), 29 deletions(-)
diff --git a/grub-core/commands/prep_loadenv.c b/grub-core/commands/prep_loadenv.c
index de1b95689..c9797c50a 100644
--- a/grub-core/commands/prep_loadenv.c
+++ b/grub-core/commands/prep_loadenv.c
@@ -15,7 +15,7 @@
@ -38,7 +39,7 @@ index de1b95689..c9797c50a 100644
{
if (match->rm_so != -1)
{
@@ -185,24 +185,18 @@ prep_partname (const char *devname, char **prep)
@@ -185,24 +185,18 @@
return err;
}
@ -67,7 +68,7 @@ index de1b95689..c9797c50a 100644
if (ret)
goto fail;
@@ -210,22 +204,11 @@ boot_disk_prep_partname (char **name)
@@ -210,22 +204,11 @@
if (! matches)
goto fail;
@ -94,7 +95,7 @@ index de1b95689..c9797c50a 100644
}
fail:
@@ -235,13 +218,58 @@ boot_disk_prep_partname (char **name)
@@ -235,13 +218,60 @@
if (!comperr)
{
regfree (&regex);
@ -117,6 +118,8 @@ index de1b95689..c9797c50a 100644
+ grub_size_t nmatch;
+ char *devname = NULL;
+
+ *name = NULL;
+
+ if (varname)
+ cmdpath = grub_env_get (varname);
+ else
@ -155,7 +158,7 @@ index de1b95689..c9797c50a 100644
}
static grub_err_t
@@ -274,13 +302,31 @@ grub_cmd_prep_loadenv (grub_command_t cmd __attribute__ ((unused)),
@@ -274,13 +304,31 @@
return GRUB_ERR_NONE;
}
@ -181,24 +184,22 @@ index de1b95689..c9797c50a 100644
early_prep_loadenv (void)
{
grub_err_t err;
char *prep;
- char *prep;
+ char *prep = NULL;
- err = boot_disk_prep_partname (&prep);
+ err = boot_disk_prep_partname (NULL, &prep);
if (err == GRUB_ERR_NONE && prep)
err = prep_read_envblk (prep);
if (err == GRUB_ERR_BAD_FILE_TYPE || err == GRUB_ERR_FILE_NOT_FOUND)
@@ -295,6 +341,10 @@ static grub_command_t cmd_prep_load;
GRUB_MOD_INIT(prep_loadenv)
@@ -296,6 +344,10 @@
{
early_env_hook = early_prep_loadenv;
+ cmd_prep_load =
cmd_prep_load =
+ grub_register_command("prep_partname", grub_cmd_prep_partname,
+ "VARNAME",
+ N_("Get partition name of PReP."));
cmd_prep_load =
+ cmd_prep_load =
grub_register_command("prep_load_env", grub_cmd_prep_loadenv,
"DEVICE",
--
2.39.2
N_("Load variables from environment block file."));

View File

@ -4,6 +4,8 @@ Tue Apr 18 02:42:23 UTC 2023 - Michael Chang <mchang@suse.com>
- Fix no prep partition error on non-PReP architectures by making the
prep_loadenv module exclusive to powerpc_ieee1275 platform (bsc#1210489)
* 0004-Introduce-prep_load_env-command.patch
- Fix the issue of freeing an uninitialized pointer
* 0002-prep_loadenv-Fix-regex-for-Open-Firmware-device-spec.patch
- Rediff
* 0005-export-environment-at-start-up.patch
* 0009-Add-crypttab_entry-to-obviate-the-need-to-input-pass.patch