Author: tfaber
Date: Sun Feb 8 14:22:26 2015
New Revision: 66208
URL:
http://svn.reactos.org/svn/reactos?rev=66208&view=rev
Log:
[DDK]
- Add additional list entry checks that can be optionally enabled by defining
EXTRA_KERNEL_LIST_ENTRY_CHECKS. These checks warn against attempts to remove items from an
empty list, which can easily be an error (and is trivial to avoid where it's not).
- Enable these checks by default for ReactOS code
CORE-8419 #resolve
Modified:
trunk/reactos/include/ddk/wdm.h
trunk/reactos/include/xdk/rtlfuncs.h
Modified: trunk/reactos/include/ddk/wdm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=6620…
==============================================================================
--- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Sun Feb 8 14:22:26 2015
@@ -9621,6 +9621,10 @@
#define NO_KERNEL_LIST_ENTRY_CHECKS
#endif
+#if !defined(EXTRA_KERNEL_LIST_ENTRY_CHECKS) && defined(__REACTOS__)
+#define EXTRA_KERNEL_LIST_ENTRY_CHECKS
+#endif
+
#if !defined(MIDL_PASS) && !defined(SORTPP_PASS)
#define RTL_STATIC_LIST_HEAD(x) LIST_ENTRY x = { &x, &x }
@@ -9693,6 +9697,10 @@
OldFlink = Entry->Flink;
OldBlink = Entry->Blink;
#if !defined(NO_KERNEL_LIST_ENTRY_CHECKS)
+#ifdef EXTRA_KERNEL_LIST_ENTRY_CHECKS
+ if (OldFlink == Entry || OldBlink == Entry)
+ FatalListEntryError(OldBlink, Entry, OldFlink);
+#endif
if (OldFlink->Blink != Entry || OldBlink->Flink != Entry)
FatalListEntryError(OldBlink, Entry, OldFlink);
#endif
@@ -9711,6 +9719,10 @@
#if !defined(NO_KERNEL_LIST_ENTRY_CHECKS) && DBG
RtlpCheckListEntry(ListHead);
+#ifdef EXTRA_KERNEL_LIST_ENTRY_CHECKS
+ if (ListHead->Flink == ListHead || ListHead->Blink == ListHead)
+ FatalListEntryError(ListHead->Blink, ListHead, ListHead->Flink);
+#endif
#endif
Entry = ListHead->Flink;
Flink = Entry->Flink;
@@ -9733,6 +9745,10 @@
#if !defined(NO_KERNEL_LIST_ENTRY_CHECKS) && DBG
RtlpCheckListEntry(ListHead);
+#ifdef EXTRA_KERNEL_LIST_ENTRY_CHECKS
+ if (ListHead->Flink == ListHead || ListHead->Blink == ListHead)
+ FatalListEntryError(ListHead->Blink, ListHead, ListHead->Flink);
+#endif
#endif
Entry = ListHead->Blink;
Blink = Entry->Blink;
Modified: trunk/reactos/include/xdk/rtlfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/rtlfuncs.h?rev…
==============================================================================
--- trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] Sun Feb 8 14:22:26 2015
@@ -35,6 +35,10 @@
#define NO_KERNEL_LIST_ENTRY_CHECKS
#endif
+#if !defined(EXTRA_KERNEL_LIST_ENTRY_CHECKS) && defined(__REACTOS__)
+#define EXTRA_KERNEL_LIST_ENTRY_CHECKS
+#endif
+
#if !defined(MIDL_PASS) && !defined(SORTPP_PASS)
#define RTL_STATIC_LIST_HEAD(x) LIST_ENTRY x = { &x, &x }
@@ -107,6 +111,10 @@
OldFlink = Entry->Flink;
OldBlink = Entry->Blink;
#if !defined(NO_KERNEL_LIST_ENTRY_CHECKS)
+#ifdef EXTRA_KERNEL_LIST_ENTRY_CHECKS
+ if (OldFlink == Entry || OldBlink == Entry)
+ FatalListEntryError(OldBlink, Entry, OldFlink);
+#endif
if (OldFlink->Blink != Entry || OldBlink->Flink != Entry)
FatalListEntryError(OldBlink, Entry, OldFlink);
#endif
@@ -125,6 +133,10 @@
#if !defined(NO_KERNEL_LIST_ENTRY_CHECKS) && DBG
RtlpCheckListEntry(ListHead);
+#ifdef EXTRA_KERNEL_LIST_ENTRY_CHECKS
+ if (ListHead->Flink == ListHead || ListHead->Blink == ListHead)
+ FatalListEntryError(ListHead->Blink, ListHead, ListHead->Flink);
+#endif
#endif
Entry = ListHead->Flink;
Flink = Entry->Flink;
@@ -147,6 +159,10 @@
#if !defined(NO_KERNEL_LIST_ENTRY_CHECKS) && DBG
RtlpCheckListEntry(ListHead);
+#ifdef EXTRA_KERNEL_LIST_ENTRY_CHECKS
+ if (ListHead->Flink == ListHead || ListHead->Blink == ListHead)
+ FatalListEntryError(ListHead->Blink, ListHead, ListHead->Flink);
+#endif
#endif
Entry = ListHead->Blink;
Blink = Entry->Blink;