summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2023-02-07 10:26:47 -0800
committerGitHub <noreply@github.com>2023-02-07 10:26:47 -0800
commit8e305d43ea7c80df310647a29b7609aeba57085d (patch)
treefd7ab41e796ac38c36fee61950680d7a16b5728e
parentd250bbd13123b792522089dc502c4e29290b354c (diff)
parent2185f7d5d7a5650dbcb6a05e9de41f340cd3b865 (diff)
downloadacpica-8e305d43ea7c80df310647a29b7609aeba57085d.tar.gz
Merge pull request #776 from t-8ch/dangling-pointer
Fix dangling pointer warning for AcpiUtInitStackPtrTrace
-rw-r--r--source/components/debugger/dbstats.c4
-rw-r--r--source/components/utilities/utdebug.c6
-rw-r--r--source/components/utilities/utinit.c2
-rw-r--r--source/include/acglobal.h4
-rw-r--r--source/include/actypes.h2
-rw-r--r--source/include/platform/aclinux.h5
6 files changed, 12 insertions, 11 deletions
diff --git a/source/components/debugger/dbstats.c b/source/components/debugger/dbstats.c
index a30d9948d..b5f31948b 100644
--- a/source/components/debugger/dbstats.c
+++ b/source/components/debugger/dbstats.c
@@ -647,8 +647,8 @@ AcpiDbDisplayStatistics (
AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer);
AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
- AcpiOsPrintf ("Entry Stack Pointer %p\n", AcpiGbl_EntryStackPointer);
- AcpiOsPrintf ("Lowest Stack Pointer %p\n", AcpiGbl_LowestStackPointer);
+ AcpiOsPrintf ("Entry Stack Pointer %p\n", ACPI_TO_POINTER(AcpiGbl_EntryStackPointer));
+ AcpiOsPrintf ("Lowest Stack Pointer %p\n", ACPI_TO_POINTER(AcpiGbl_LowestStackPointer));
AcpiOsPrintf ("Stack Use %X (%u)\n", Temp, Temp);
AcpiOsPrintf ("Deepest Procedure Nesting %u\n", AcpiGbl_DeepestNesting);
#endif
diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c
index b0c3640f2..b6e914592 100644
--- a/source/components/utilities/utdebug.c
+++ b/source/components/utilities/utdebug.c
@@ -185,7 +185,7 @@ AcpiUtInitStackPtrTrace (
ACPI_SIZE CurrentSp;
- AcpiGbl_EntryStackPointer = &CurrentSp;
+ AcpiGbl_EntryStackPointer = ACPI_TO_INTEGER(&CurrentSp);
}
@@ -208,9 +208,9 @@ AcpiUtTrackStackPtr (
ACPI_SIZE CurrentSp;
- if (&CurrentSp < AcpiGbl_LowestStackPointer)
+ if (ACPI_TO_INTEGER(&CurrentSp) < AcpiGbl_LowestStackPointer)
{
- AcpiGbl_LowestStackPointer = &CurrentSp;
+ AcpiGbl_LowestStackPointer = ACPI_TO_INTEGER(&CurrentSp);
}
if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
diff --git a/source/components/utilities/utinit.c b/source/components/utilities/utinit.c
index 37ec63bc6..1e21ebdc3 100644
--- a/source/components/utilities/utinit.c
+++ b/source/components/utilities/utinit.c
@@ -359,7 +359,7 @@ AcpiUtInitGlobals (
#endif
#ifdef ACPI_DEBUG_OUTPUT
- AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX);
+ AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX;
#endif
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
diff --git a/source/include/acglobal.h b/source/include/acglobal.h
index 28fc6514b..1010f768a 100644
--- a/source/include/acglobal.h
+++ b/source/include/acglobal.h
@@ -332,8 +332,8 @@ extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_
ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeCount);
ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeSize);
ACPI_GLOBAL (UINT32, AcpiGbl_MaxConcurrentNodeCount);
-ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_EntryStackPointer);
-ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_LowestStackPointer);
+ACPI_GLOBAL (ACPI_UINTPTR_T, AcpiGbl_EntryStackPointer);
+ACPI_GLOBAL (ACPI_UINTPTR_T, AcpiGbl_LowestStackPointer);
ACPI_GLOBAL (UINT32, AcpiGbl_DeepestNesting);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0);
#endif
diff --git a/source/include/actypes.h b/source/include/actypes.h
index 77fa92123..8486d2b98 100644
--- a/source/include/actypes.h
+++ b/source/include/actypes.h
@@ -649,7 +649,7 @@ typedef UINT64 ACPI_INTEGER;
/* Pointer manipulation */
-#define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p))
+#define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (void *) (p))
#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p))
#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
#define ACPI_SUB_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b)))
diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h
index 9035389d2..025fc8007 100644
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -168,6 +168,8 @@
#define ACPI_USE_DO_WHILE_0
#define ACPI_IGNORE_PACKAGE_RESOLUTION_ERRORS
+#define ACPI_UINTPTR_T uintptr_t
+
#ifdef __KERNEL__
@@ -252,8 +254,6 @@
#define ACPI_SPINLOCK spinlock_t *
#define ACPI_CPU_FLAGS unsigned long
-#define ACPI_UINTPTR_T uintptr_t
-
#define ACPI_TO_INTEGER(p) ((uintptr_t)(p))
#define ACPI_OFFSET(d, f) offsetof(d, f)
@@ -311,6 +311,7 @@
#ifdef ACPI_USE_STANDARD_HEADERS
#include <unistd.h>
+#include <stdint.h>
#endif
/* Define/disable kernel-specific declarators */