https://git.reactos.org/?p=reactos.git;a=commitdiff;h=66cf1d20f4894017a5cc2ce9aaa1190b61854718

commit 66cf1d20f4894017a5cc2ce9aaa1190b61854718
Author:     Victor Perevertkin <[email protected]>
AuthorDate: Sun Jan 17 01:46:35 2021 +0300
Commit:     Victor Perevertkin <[email protected]>
CommitDate: Sun Jan 17 01:46:35 2021 +0300

    [SCSIPORT] Use pointer alignment for MiniPortDeviceExtension
    
    This seems logical and some miniport drivers (uniata) actually rely on
    that.
    
    CORE-17424
---
 drivers/storage/port/scsiport/scsiport.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/storage/port/scsiport/scsiport.h 
b/drivers/storage/port/scsiport/scsiport.h
index d3ee010cab1..4933c4c9bb9 100644
--- a/drivers/storage/port/scsiport/scsiport.h
+++ b/drivers/storage/port/scsiport/scsiport.h
@@ -217,6 +217,12 @@ typedef struct _SCSI_PORT_SAVE_INTERRUPT
  *  part is the miniport-specific device extension.
  */
 
+#ifdef _WIN64
+#define ALIGNAS_PTR DECLSPEC_ALIGN(8)
+#else
+#define ALIGNAS_PTR DECLSPEC_ALIGN(4)
+#endif
+
 // FDO
 typedef struct _SCSI_PORT_DEVICE_EXTENSION
 {
@@ -312,7 +318,9 @@ typedef struct _SCSI_PORT_DEVICE_EXTENSION
     BOOLEAN DeviceStarted;
     UINT8 TotalLUCount;
 
-    UCHAR MiniPortDeviceExtension[1]; /* must be the last entry */
+    // use the pointer alignment here, some miniport drivers rely on this
+    // moreover, it has to be the last member
+    ALIGNAS_PTR UCHAR MiniPortDeviceExtension[];
 } SCSI_PORT_DEVICE_EXTENSION, *PSCSI_PORT_DEVICE_EXTENSION;
 
 typedef struct _RESETBUS_PARAMS

Reply via email to