Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2
efibootmgr
MARM-sanitize-set_mirror.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File MARM-sanitize-set_mirror.diff of Package efibootmgr
--- src/efibootmgr/efibootmgr.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) --- a/src/efibootmgr/efibootmgr.c +++ b/src/efibootmgr/efibootmgr.c @@ -900,15 +900,14 @@ get_mirror(int which, int *below4g, int rc = read_variable(name_guid, var); if (rc == 0) { abm = (ADDRESS_RANGE_MIRROR_VARIABLE_DATA *) var->Data; - if (!which && abm->mirror_version != MIRROR_VERSION) { - fprintf(stderr, "** Warning ** : unrecognised version for memory mirror i/f\n"); - return 2; - } *below4g = abm->mirror_memory_below_4gb; *above4g = abm->mirror_amount_above_4gb; *mirrorstatus = abm->mirror_status; + if (!which && abm->mirror_version != MIRROR_VERSION) { + rc = 2; + } } - efichar_from_char(var->VariableName, name, 1024); + free(var); return rc; } @@ -921,31 +920,36 @@ set_mirror(int below4g, int above4g) efi_variable_t *var; char *name; - if ((s = get_mirror(0, &oldbelow4g, &oldabove4g, &status)) == 0) { - if (oldbelow4g == below4g && oldabove4g == above4g) - return 0; - } else { - fprintf(stderr, "** Warning ** : platform does not support memory mirror\n"); + if ((s = get_mirror(0, &oldbelow4g, &oldabove4g, &status)) != 0) { + if (s == 2) + fprintf(stderr, "** Warning ** : unrecognised version for memory mirror i/f\n"); + else + fprintf(stderr, "** Warning ** : platform does not support memory mirror\n"); return s; } + below4g = opts.set_mirror_lo ? below4g : oldbelow4g; + above4g = opts.set_mirror_hi ? above4g : oldabove4g; + if (oldbelow4g == below4g && oldabove4g == above4g) + return 0; + var = malloc(sizeof(var_entry_t)); memset(var, 0, sizeof(efi_variable_t)); var->DataSize = sizeof (abm); - memcpy(&(var->Data), (uint8_t *)&abm, var->DataSize); var->Attributes = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS; abm.mirror_version = MIRROR_VERSION; - abm.mirror_amount_above_4gb = opts.set_mirror_hi ? above4g : oldabove4g; - abm.mirror_memory_below_4gb = opts.set_mirror_lo ? below4g : oldbelow4g; + abm.mirror_amount_above_4gb = above4g; + abm.mirror_memory_below_4gb = below4g; abm.mirror_status = 0; memcpy(&(var->Data), (uint8_t *)&abm, var->DataSize); var->VendorGuid = ADDRESS_RANGE_MIRROR_VARIABLE_GUID; name = ADDRESS_RANGE_MIRROR_VARIABLE_REQUEST; efichar_from_char(var->VariableName, name, 1024); rc = create_or_edit_variable(var); + free(var); return rc; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor