Author: tkreuzer
Date: Sun Oct 18 16:36:03 2009
New Revision: 43554
URL:
http://svn.reactos.org/svn/reactos?rev=43554&view=rev
Log:
Add alignment checks to KdpSysReadIoSpace and KdpSysWriteIoSpace
Modified:
branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kdsup.c
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kdsup.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kdsup.c [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kdsup.c [iso-8859-1] Sun Oct 18
16:36:03 2009
@@ -264,6 +264,14 @@
return STATUS_INVALID_PARAMETER;
}
+ /* Check for correct alignment */
+ if ((IoAddress & (DataSize - 1)))
+ {
+ /* Invalid alignment */
+ *ActualDataSize = 0;
+ return STATUS_DATATYPE_MISALIGNMENT;
+ }
+
switch (DataSize)
{
case sizeof(UCHAR):
@@ -284,7 +292,7 @@
default:
/* Invalid data size */
*ActualDataSize = 0;
- return STATUS_UNSUCCESSFUL;
+ return STATUS_INVALID_PARAMETER;
}
/* Return the size of the data */
@@ -313,6 +321,14 @@
return STATUS_INVALID_PARAMETER;
}
+ /* Check for correct alignment */
+ if ((IoAddress & (DataSize - 1)))
+ {
+ /* Invalid alignment */
+ *ActualDataSize = 0;
+ return STATUS_DATATYPE_MISALIGNMENT;
+ }
+
switch (DataSize)
{
case sizeof(UCHAR):
@@ -333,7 +349,7 @@
default:
/* Invalid data size */
*ActualDataSize = 0;
- return STATUS_UNSUCCESSFUL;
+ return STATUS_INVALID_PARAMETER;
}
/* Return the size of the data */