Re: [PATCH] ACPI: APEI: Fix num_ghes to unsigned int

From: Rafael J. Wysocki
Date: Wed Oct 05 2022 - 10:29:06 EST


On Wed, Oct 5, 2022 at 1:06 AM Ashish Kalra <Ashish.Kalra@xxxxxxx> wrote:
>
> From: Ashish Kalra <ashish.kalra@xxxxxxx>
>
> Change num_ghes from int to unsigned int, preventing an overflow
> and causing subsequent vmalloc to fail.

So do you have a system where int is not sufficient?

> Signed-off-by: Ashish Kalra <ashish.kalra@xxxxxxx>
> ---
> drivers/acpi/apei/ghes.c | 2 +-
> include/acpi/ghes.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index d91ad378c00d..6d7c202142a6 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -163,7 +163,7 @@ static void ghes_unmap(void __iomem *vaddr, enum fixed_addresses fixmap_idx)
> clear_fixmap(fixmap_idx);
> }
>
> -int ghes_estatus_pool_init(int num_ghes)
> +int ghes_estatus_pool_init(unsigned int num_ghes)
> {
> unsigned long addr, len;
> int rc;
> diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h
> index 34fb3431a8f3..292a5c40bd0c 100644
> --- a/include/acpi/ghes.h
> +++ b/include/acpi/ghes.h
> @@ -71,7 +71,7 @@ int ghes_register_vendor_record_notifier(struct notifier_block *nb);
> void ghes_unregister_vendor_record_notifier(struct notifier_block *nb);
> #endif
>
> -int ghes_estatus_pool_init(int num_ghes);
> +int ghes_estatus_pool_init(unsigned int num_ghes);
>
> /* From drivers/edac/ghes_edac.c */
>
> --
> 2.25.1
>