Commit 08f1f212 authored by Jorge Lopez's avatar Jorge Lopez Committed by Hans de Goede

platform/x86: hp-bioscfg: Change how prerequisites size is evaluated

Update steps taken to evaluate prerequisites size value
Signed-off-by: default avatarJorge Lopez <jorge.lopez2@hp.com>
Link: https://lore.kernel.org/r/20230731203141.30044-5-jorge.lopez2@hp.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent a585400b
......@@ -190,9 +190,11 @@ static int hp_populate_enumeration_elements_from_package(union acpi_object *enum
enum_data->common.sequence = int_value;
break;
case PREREQUISITES_SIZE:
enum_data->common.prerequisites_size = int_value;
if (int_value > MAX_PREREQUISITES_SIZE)
if (int_value > MAX_PREREQUISITES_SIZE) {
pr_warn("Prerequisites size value exceeded the maximum number of elements supported or data may be malformed\n");
int_value = MAX_PREREQUISITES_SIZE;
}
enum_data->common.prerequisites_size = int_value;
/*
* This step is needed to keep the expected
......
......@@ -208,8 +208,12 @@ static int hp_populate_integer_elements_from_package(union acpi_object *integer_
integer_data->common.sequence = int_value;
break;
case PREREQUISITES_SIZE:
if (integer_data->common.prerequisites_size > MAX_PREREQUISITES_SIZE)
if (int_value > MAX_PREREQUISITES_SIZE) {
pr_warn("Prerequisites size value exceeded the maximum number of elements supported or data may be malformed\n");
int_value = MAX_PREREQUISITES_SIZE;
}
integer_data->common.prerequisites_size = int_value;
/*
* This step is needed to keep the expected
* element list pointing to the right obj[elem].type
......
......@@ -202,9 +202,11 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord
ordered_list_data->common.sequence = int_value;
break;
case PREREQUISITES_SIZE:
ordered_list_data->common.prerequisites_size = int_value;
if (int_value > MAX_PREREQUISITES_SIZE)
if (int_value > MAX_PREREQUISITES_SIZE) {
pr_warn("Prerequisites size value exceeded the maximum number of elements supported or data may be malformed\n");
int_value = MAX_PREREQUISITES_SIZE;
}
ordered_list_data->common.prerequisites_size = int_value;
/*
* This step is needed to keep the expected
......
......@@ -289,9 +289,11 @@ static int hp_populate_password_elements_from_package(union acpi_object *passwor
password_data->common.sequence = int_value;
break;
case PREREQUISITES_SIZE:
password_data->common.prerequisites_size = int_value;
if (int_value > MAX_PREREQUISITES_SIZE)
if (int_value > MAX_PREREQUISITES_SIZE) {
pr_warn("Prerequisites size value exceeded the maximum number of elements supported or data may be malformed\n");
int_value = MAX_PREREQUISITES_SIZE;
}
password_data->common.prerequisites_size = int_value;
/* This step is needed to keep the expected
* element list pointing to the right obj[elem].type
......
......@@ -198,10 +198,12 @@ static int hp_populate_string_elements_from_package(union acpi_object *string_ob
string_data->common.sequence = int_value;
break;
case PREREQUISITES_SIZE:
if (int_value > MAX_PREREQUISITES_SIZE) {
pr_warn("Prerequisites size value exceeded the maximum number of elements supported or data may be malformed\n");
int_value = MAX_PREREQUISITES_SIZE;
}
string_data->common.prerequisites_size = int_value;
if (string_data->common.prerequisites_size > MAX_PREREQUISITES_SIZE)
pr_warn("Prerequisites size value exceeded the maximum number of elements supported or data may be malformed\n");
/*
* This step is needed to keep the expected
* element list pointing to the right obj[elem].type
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment