Skip to content

Commit 916727c

Browse files
superm1ij-intel
authored andcommitted
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: 6b2770b ("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>
1 parent cd08830 commit 916727c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,11 @@ int hp_alloc_enumeration_data(void)
9494
bioscfg_drv.enumeration_instances_count =
9595
hp_get_instance_count(HP_WMI_BIOS_ENUMERATION_GUID);
9696

97-
bioscfg_drv.enumeration_data = kzalloc_objs(*bioscfg_drv.enumeration_data,
98-
bioscfg_drv.enumeration_instances_count);
97+
if (!bioscfg_drv.enumeration_instances_count)
98+
return -EINVAL;
99+
bioscfg_drv.enumeration_data = kvcalloc(bioscfg_drv.enumeration_instances_count,
100+
sizeof(*bioscfg_drv.enumeration_data), GFP_KERNEL);
101+
99102
if (!bioscfg_drv.enumeration_data) {
100103
bioscfg_drv.enumeration_instances_count = 0;
101104
return -ENOMEM;
@@ -444,6 +447,6 @@ void hp_exit_enumeration_attributes(void)
444447
}
445448
bioscfg_drv.enumeration_instances_count = 0;
446449

447-
kfree(bioscfg_drv.enumeration_data);
450+
kvfree(bioscfg_drv.enumeration_data);
448451
bioscfg_drv.enumeration_data = NULL;
449452
}

0 commit comments

Comments
 (0)