Skip to content

Commit

Permalink
i386/txt/txt.c: don't test grub_errno, something else messed it up
Browse files Browse the repository at this point in the history
Signed-off-by: Krystian Hebel <[email protected]>
  • Loading branch information
krystian-hebel committed Feb 20, 2024
1 parent bd35418 commit f3901ac
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions grub-core/loader/i386/txt/txt.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ enable_smx_mode (void)
return grub_errno;
}

static void
static grub_err_t
grub_txt_smx_parameters (struct grub_smx_parameters *params)
{
grub_uint32_t index = 0, eax, ebx, ecx, param_type;
Expand All @@ -151,10 +151,7 @@ grub_txt_smx_parameters (struct grub_smx_parameters *params)

case GRUB_SMX_PARAMETER_ACM_VERSIONS:
if (params->version_count >= GRUB_SMX_PARAMETER_MAX_VERSIONS)
{
grub_error (GRUB_ERR_OUT_OF_RANGE, N_("Too many ACM versions"));
break;
}
return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("Too many ACM versions"));
params->versions[params->version_count].mask = ebx;
params->versions[params->version_count++].version = ecx;
break;
Expand All @@ -176,8 +173,7 @@ grub_txt_smx_parameters (struct grub_smx_parameters *params)
break;

default:
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Unknown SMX parameter"));
param_type = GRUB_SMX_PARAMETER_NULL;
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Unknown SMX parameter"));
}

++index;
Expand All @@ -191,6 +187,8 @@ grub_txt_smx_parameters (struct grub_smx_parameters *params)
params->versions[0].version = GRUB_SMX_DEFAULT_VERSION;
params->version_count++;
}

return GRUB_ERR_NONE;
}

grub_err_t
Expand All @@ -200,6 +198,7 @@ grub_txt_prepare_cpu (void)
grub_uint32_t i;
grub_uint64_t mcg_cap, mcg_stat;
unsigned long cr0;
grub_err_t err;

grub_dprintf ("slaunch", "XXX grub_errno = %x\n", grub_errno);
cr0 = grub_read_cr0 ();
Expand Down Expand Up @@ -230,10 +229,10 @@ grub_txt_prepare_cpu (void)
N_("machine check in progress during secure launch"));

grub_dprintf ("slaunch", "XXX grub_errno = %x\n", grub_errno);
grub_txt_smx_parameters (&params);
err = grub_txt_smx_parameters (&params);
grub_dprintf ("slaunch", "XXX grub_errno = %x\n", grub_errno);
if (grub_errno != GRUB_ERR_NONE)
return grub_errno;
if (err != GRUB_ERR_NONE)
return err;

grub_dprintf ("slaunch", "XXX grub_errno = %x\n", grub_errno);
if (params.txt_feature_ext_flags & GRUB_SMX_PROCESSOR_BASE_SCRTM)
Expand Down

0 comments on commit f3901ac

Please sign in to comment.