Unverified Commit 916727cf authored by Mario Limonciello's avatar Mario Limonciello Committed by Ilpo Järvinen
Browse files

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: 6b2770bf ("platform/x86: hp-bioscfg: enum-attributes")
Cc: stable@vger.kernel.org
Reported-by: default avatarPaul Kerry <p.kerry@sheffield.ac.uk>
Tested-by: default avatarPaul Kerry <p.kerry@sheffield.ac.uk>
Closes: https://bugs.debian.org/1127612


Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20260225210646.59381-1-mario.limonciello@amd.com


Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent cd088305
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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;
}