[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0j5LVV_gV_K45YqFPqtBcS423VP0x_Uos7MtKBeqWkg5A@mail.gmail.com>
Date: Fri, 14 Jan 2022 19:09:18 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Jiasheng Jiang <jiasheng@...as.ac.cn>
Cc: Robert Moore <robert.moore@...el.com>,
Rafael Wysocki <rafael.j.wysocki@...el.com>,
Len Brown <lenb@...nel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
"open list:ACPI COMPONENT ARCHITECTURE (ACPICA)" <devel@...ica.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ACPI/ACPICA: Check for NULL pointer after calling alloc
On Fri, Jan 14, 2022 at 11:16 AM Jiasheng Jiang <jiasheng@...as.ac.cn> wrote:
>
> As the possible failure of the allocation, object_info could be NULL
> pointer.
> Therefore, it should be better to check it in order to avoid the
> dereference of the NULL pointer.
> If fails, we should return 'AE_NON_MEMORY' and the caller
> acpi_db_command_dispatch() will deal with the return status of
> acpi_db_display_objects().
> Also, the comment of the acpi_db_display_objects() is wrong.
> So we need to correct it too.
>
> Fixes: 995751025572 ("ACPICA: Linuxize: Export debugger files to Linux")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
This is ACPICA material, so it needs to be submitted to the upstream
ACPICA project via https://github.com/acpica/acpica, thanks!
> ---
> drivers/acpi/acpica/dbnames.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/acpica/dbnames.c b/drivers/acpi/acpica/dbnames.c
> index 3615e1a6efd8..d8e5852fadb1 100644
> --- a/drivers/acpi/acpica/dbnames.c
> +++ b/drivers/acpi/acpica/dbnames.c
> @@ -632,7 +632,7 @@ acpi_db_walk_for_specific_objects(acpi_handle obj_handle,
> * PARAMETERS: obj_type_arg - Type of object to display
> * display_count_arg - Max depth to display
> *
> - * RETURN: None
> + * RETURN: Status
> *
> * DESCRIPTION: Display objects in the namespace of the requested type
> *
> @@ -651,6 +651,8 @@ acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg)
> if (!obj_type_arg) {
> object_info =
> ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_object_info));
> + if (!object_info)
> + return (AE_NO_MEMORY);
>
> /* Walk the namespace from the root */
>
> --
> 2.25.1
>
Powered by blists - more mailing lists