* [PATCH] platform/x86: hp-bioscfg: Support allocations of larger data
@ 2026-09-23 17:46 Artem Maksimov
0 siblings, 0 replies; only message in thread
From: Artem Maksimov @ 2026-09-23 17:46 UTC (permalink / raw)
To: jorge.lopez2, hansg, ilpo.jarvinen
Cc: platform-driver-x86, linux-kernel, Artem Maksimov
Memory allocation for ordered_list_data and string_data
can fail if contiguous physical memory is fragmented or insufficient.
Switch from kzalloc_objs to kvzalloc_objs to fall back to
visually/virtually contiguous memory (vmalloc) when
physically contiguous allocation fails.
Signed-off-by: Artem Maksimov <okuroshioffc@gmail.com>
---
.../x86/hp/hp-bioscfg/order-list-attributes.c | 11 ++++++++---
.../platform/x86/hp/hp-bioscfg/string-attributes.c | 11 ++++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
index 5bf8d40bdf81..80ac15435a18 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
@@ -98,8 +98,13 @@ int hp_alloc_ordered_list_data(void)
{
bioscfg_drv.ordered_list_instances_count =
hp_get_instance_count(HP_WMI_BIOS_ORDERED_LIST_GUID);
- bioscfg_drv.ordered_list_data = kzalloc_objs(*bioscfg_drv.ordered_list_data,
- bioscfg_drv.ordered_list_instances_count);
+
+ if (!bioscfg_drv.ordered_list_instances_count)
+ return -EINVAL;
+ bioscfg_drv.ordered_list_data =
+ kvzalloc_objs(*bioscfg_drv.ordered_list_data,
+ bioscfg_drv.ordered_list_instances_count);
+
if (!bioscfg_drv.ordered_list_data) {
bioscfg_drv.ordered_list_instances_count = 0;
return -ENOMEM;
@@ -438,6 +443,6 @@ void hp_exit_ordered_list_attributes(void)
}
bioscfg_drv.ordered_list_instances_count = 0;
- kfree(bioscfg_drv.ordered_list_data);
+ kvfree(bioscfg_drv.ordered_list_data);
bioscfg_drv.ordered_list_data = NULL;
}
diff --git a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
index f3dfba270f7e..095201004d87 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
@@ -101,8 +101,13 @@ static const struct attribute_group string_attr_group = {
int hp_alloc_string_data(void)
{
bioscfg_drv.string_instances_count = hp_get_instance_count(HP_WMI_BIOS_STRING_GUID);
- bioscfg_drv.string_data = kzalloc_objs(*bioscfg_drv.string_data,
- bioscfg_drv.string_instances_count);
+
+ if (!bioscfg_drv.string_instances_count)
+ return -EINVAL;
+ bioscfg_drv.string_data =
+ kvzalloc_objs(*bioscfg_drv.string_data,
+ bioscfg_drv.string_instances_count);
+
if (!bioscfg_drv.string_data) {
bioscfg_drv.string_instances_count = 0;
return -ENOMEM;
@@ -390,6 +395,6 @@ void hp_exit_string_attributes(void)
}
bioscfg_drv.string_instances_count = 0;
- kfree(bioscfg_drv.string_data);
+ kvfree(bioscfg_drv.string_data);
bioscfg_drv.string_data = NULL;
}
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-23 17:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 17:46 [PATCH] platform/x86: hp-bioscfg: Support allocations of larger data Artem Maksimov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®