Skip to content

Commit fb4a180

Browse files
elizashurovYanVugenfirer
authored andcommitted
[viogpu] Initialize uninitialized members to prevent undefined behavior
- Zero m_SystemDisplayInfo in VioGpuDod::VioGpuDod() - Initialize m_u64HostFeatures / m_u64GuestFeatures in VioGpuAdapter::VioGpuAdapter() - Initialize CSessionMgr::m_hThread to NULL Signed-off-by: Elizabeth Ashurov <eashurov@redhat.com>
1 parent 271b7a8 commit fb4a180

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

viogpu/viogpudo/viogpudo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ VioGpuDod::VioGpuDod(_In_ DEVICE_OBJECT *pPhysicalDeviceObject)
5353
RtlZeroMemory(&m_DxgkInterface, sizeof(m_DxgkInterface));
5454
RtlZeroMemory(&m_DeviceInfo, sizeof(m_DeviceInfo));
5555
RtlZeroMemory(&m_CurrentMode, sizeof(m_CurrentMode));
56+
RtlZeroMemory(&m_SystemDisplayInfo, sizeof(m_SystemDisplayInfo));
5657
RtlZeroMemory(&m_PointerShape, sizeof(m_PointerShape));
5758
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
5859
}
@@ -2191,6 +2192,8 @@ VioGpuAdapter::VioGpuAdapter(_In_ VioGpuDod *pVioGpuDod)
21912192
m_pWorkThread = NULL;
21922193
m_ResolutionEvent = NULL;
21932194
m_ResolutionEventHandle = NULL;
2195+
m_u64HostFeatures = 0;
2196+
m_u64GuestFeatures = 0;
21942197
m_u32NumCapsets = 0;
21952198
m_u32NumScanouts = 0;
21962199

viogpu/viogpusc/SessionMgr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "SessionMgr.h"
3232
#include "Session.h"
3333

34-
CSessionMgr::CSessionMgr()
34+
CSessionMgr::CSessionMgr() : m_hThread(NULL)
3535
{
3636
PrintMessage(L"%ws\n", __FUNCTIONW__);
3737
}

0 commit comments

Comments
 (0)