platform/x86: hp-bioscfg: Support allocations of larger data

Some systems have much larger amounts of enumeration attributes
than have been previously encountered. This can lead to page allocation
failures when using kcalloc().  Switch over to using kvcalloc() to
allow larger allocations.

Fixes: 6b2770bfd6 ("platform/x86: hp-bioscfg: enum-attributes")
Cc: stable@vger.kernel.org
Reported-by: Paul Kerry <p.kerry@sheffield.ac.uk>
Tested-by: Paul Kerry <p.kerry@sheffield.ac.uk>
Closes: https://bugs.debian.org/1127612
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20260225210646.59381-1-mario.limonciello@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
Mario Limonciello 2026-02-25 15:06:46 -06:00 committed by Ilpo Järvinen
parent cd0883055b
commit 916727cfdb
No known key found for this signature in database
GPG Key ID: 59AC4F6153E5CE31
1 changed files with 6 additions and 3 deletions

View File

@ -94,8 +94,11 @@ int hp_alloc_enumeration_data(void)
bioscfg_drv.enumeration_instances_count =
hp_get_instance_count(HP_WMI_BIOS_ENUMERATION_GUID);
bioscfg_drv.enumeration_data = kzalloc_objs(*bioscfg_drv.enumeration_data,
bioscfg_drv.enumeration_instances_count);
if (!bioscfg_drv.enumeration_instances_count)
return -EINVAL;
bioscfg_drv.enumeration_data = kvcalloc(bioscfg_drv.enumeration_instances_count,
sizeof(*bioscfg_drv.enumeration_data), GFP_KERNEL);
if (!bioscfg_drv.enumeration_data) {
bioscfg_drv.enumeration_instances_count = 0;
return -ENOMEM;
@ -444,6 +447,6 @@ void hp_exit_enumeration_attributes(void)
}
bioscfg_drv.enumeration_instances_count = 0;
kfree(bioscfg_drv.enumeration_data);
kvfree(bioscfg_drv.enumeration_data);
bioscfg_drv.enumeration_data = NULL;
}