linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
@ 2023-02-26  6:19 Kang Chen
  2023-03-20 17:02 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Kang Chen @ 2023-02-26  6:19 UTC (permalink / raw)
  To: lenb
  Cc: robert.moore, rafael.j.wysocki, linux-acpi, acpica-devel,
	linux-kernel, Kang Chen

ACPI_ALLOCATE_ZEROED may fails, object_info might be null and will
cause null pointer dereference later.

Signed-off-by: Kang Chen <void0red@gmail.com>
---
 drivers/acpi/acpica/dbnames.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/acpica/dbnames.c b/drivers/acpi/acpica/dbnames.c
index 3615e1a6e..b91155ea9 100644
--- a/drivers/acpi/acpica/dbnames.c
+++ b/drivers/acpi/acpica/dbnames.c
@@ -652,6 +652,9 @@ acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg)
 		object_info =
 		    ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_object_info));
 
+		if (!object_info)
+			return (AE_NO_MEMORY);
+
 		/* Walk the namespace from the root */
 
 		(void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
  2023-02-26  6:19 [PATCH] ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects Kang Chen
@ 2023-03-20 17:02 ` Rafael J. Wysocki
  2023-04-10  9:36   ` [PATCH v2] " Kang Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2023-03-20 17:02 UTC (permalink / raw)
  To: Kang Chen
  Cc: lenb, robert.moore, rafael.j.wysocki, linux-acpi, acpica-devel,
	linux-kernel

On Sun, Feb 26, 2023 at 7:19 AM Kang Chen <void0red@gmail.com> wrote:
>
> ACPI_ALLOCATE_ZEROED may fails, object_info might be null and will
> cause null pointer dereference later.
>
> Signed-off-by: Kang Chen <void0red@gmail.com>

As a rule, ACPICA changes need to be submitted as pull requests to the
upstream ACPICA project on GitHub in the first place.

When this happens, please resend the patch with a Link tag pointing to
the corresponding upstream pull request.

> ---
>  drivers/acpi/acpica/dbnames.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/acpi/acpica/dbnames.c b/drivers/acpi/acpica/dbnames.c
> index 3615e1a6e..b91155ea9 100644
> --- a/drivers/acpi/acpica/dbnames.c
> +++ b/drivers/acpi/acpica/dbnames.c
> @@ -652,6 +652,9 @@ acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg)
>                 object_info =
>                     ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_object_info));
>
> +               if (!object_info)
> +                       return (AE_NO_MEMORY);
> +
>                 /* Walk the namespace from the root */
>
>                 (void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
  2023-03-20 17:02 ` Rafael J. Wysocki
@ 2023-04-10  9:36   ` Kang Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Kang Chen @ 2023-04-10  9:36 UTC (permalink / raw)
  To: rafael
  Cc: acpica-devel, lenb, linux-acpi, linux-kernel, rafael.j.wysocki,
	robert.moore, void0red

From: Kang Chen <void0red@gmail.com>

ACPI_ALLOCATE_ZEROED may fails, object_info might be null and will
cause null pointer dereference later.

Link: https://github.com/acpica/acpica/commit/84b3752cfa0ce4b0ebecae5e193c937b8ed6e278
Signed-off-by: Kang Chen <void0red@gmail.com>
---
v2 -> v1: add a github link

 drivers/acpi/acpica/dbnames.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/acpica/dbnames.c b/drivers/acpi/acpica/dbnames.c
index 3615e1a6e..b91155ea9 100644
--- a/drivers/acpi/acpica/dbnames.c
+++ b/drivers/acpi/acpica/dbnames.c
@@ -652,6 +652,9 @@ acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg)
 		object_info =
 		    ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_object_info));
 
+		if (!object_info)
+			return (AE_NO_MEMORY);
+
 		/* Walk the namespace from the root */
 
 		(void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-10  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-26  6:19 [PATCH] ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects Kang Chen
2023-03-20 17:02 ` Rafael J. Wysocki
2023-04-10  9:36   ` [PATCH v2] " Kang Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).