From cc8c10376cfb2432342730409644b025129b1a5f Mon Sep 17 00:00:00 2001 From: Andrew Yang <30510259+AndrewYangMSFT@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:44:58 -0800 Subject: [PATCH] [serial/VirtualSerial2] Use helper function ReadNoFence to read lineControlRegister to avoid C26837 (#1257) * Use helper function ReadNoFence() to read lineControlRegister to avoid C26837 https://learn.microsoft.com/en-us/cpp/code-quality/c26837?view=msvc-170 --- serial/VirtualSerial2/queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/serial/VirtualSerial2/queue.c b/serial/VirtualSerial2/queue.c index 83b022de2..371ef6936 100644 --- a/serial/VirtualSerial2/queue.c +++ b/serial/VirtualSerial2/queue.c @@ -717,7 +717,7 @@ QueueProcessGetLineControl( // // Take a snapshot of the line control register variable // - lineControlSnapshot = *lineControlRegister; + lineControlSnapshot = ReadNoFence((LONG *)lineControlRegister); // // Decode the word length @@ -946,7 +946,7 @@ QueueProcessSetLineControl( #endif } - lineControlSnapshot = *lineControlRegister; + lineControlSnapshot = ReadNoFence((LONG *)lineControlRegister); lineControlNew = (lineControlSnapshot & SERIAL_LCR_BREAK) | (lineControlData | lineControlParity | lineControlStop);