[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fwts-devel
Subject:    [PATCH] debugger: check for memory allocation failure on object Elements
From:       Colin King <colin.king () canonical ! com>
Date:       2019-11-27 13:07:54
Message-ID: 20191127130754.37321-1-colin.king () canonical ! com
[Download RAW message or body]

From: Colin Ian King <colin.king@canonical.com>

The allocation of Elements may fail, so add a null check to
avoid any null pointer dereference faulting.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/source/components/debugger/dbconvert.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/acpica/source/components/debugger/dbconvert.c \
b/src/acpica/source/components/debugger/dbconvert.c index 6b58bf5f..a9014b8f 100644
--- a/src/acpica/source/components/debugger/dbconvert.c
+++ b/src/acpica/source/components/debugger/dbconvert.c
@@ -354,6 +354,10 @@ AcpiDbConvertToPackage (
 
     Elements = ACPI_ALLOCATE_ZEROED (
         DB_DEFAULT_PKG_ELEMENTS * sizeof (ACPI_OBJECT));
+    if (!Elements)
+    {
+        return (AE_NO_MEMORY);
+    }
 
     This = String;
     for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++)
-- 
2.24.0


-- 
fwts-devel mailing list
fwts-devel@lists.ubuntu.com
Modify settings or unsubscribe at: \
https://lists.ubuntu.com/mailman/listinfo/fwts-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic