Author: sginsberg
Date: Sat Oct 31 01:39:16 2009
New Revision: 43862

URL: http://svn.reactos.org/svn/reactos?rev=43862&view=rev
Log:
- Clarify a check and don't cast KPCR->GDT to PKIPCR (spotted by Timo).

Modified:
    trunk/reactos/ntoskrnl/ke/i386/ldt.c

Modified: trunk/reactos/ntoskrnl/ke/i386/ldt.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ldt.c?rev=43862&r1=43861&r2=43862&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/ldt.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/ldt.c [iso-8859-1] Sat Oct 31 01:39:16 2009
@@ -27,10 +27,10 @@
                        IN ULONG Offset,
                        IN PKGDTENTRY Descriptor)
 {
-    /* Make sure the offset is inside the allowed range */
-    if (!((Offset) < (KGDT_NUMBER * sizeof(KGDTENTRY))))
-    {
-        /* It isn't, fail */
+    /* Make sure the offset isn't outside the allowed range */
+    if (Offset >= (KGDT_NUMBER * sizeof(KGDTENTRY)))
+    {
+        /* It is, fail */
         return STATUS_ACCESS_VIOLATION;
     }
 
@@ -46,7 +46,7 @@
     {
         /* Get the descriptor entry from the GDT */
         RtlCopyMemory(Descriptor,
-                      (PCHAR)((PKIPCR)KeGetPcr()->GDT) + Offset,
+                      (PVOID)(((ULONG_PTR)KeGetPcr()->GDT) + Offset),
                       sizeof(KGDTENTRY));
 
         /* Check if this is the TEB selector */


Reply via email to