mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 05:24:39 +01:00
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:
parent
cd0883055b
commit
916727cfdb
1 changed files with 6 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue