mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:43:04 +00:00
[NTOS:Mm] Fix a 64 bit issue in MmMapViewOfArm3Section (#778)
Fixes a Clang-Cl warning CORE-14306
This commit is contained in:
parent
d5181e44dd
commit
f43a7b81a7
1 changed files with 6 additions and 3 deletions
|
@ -9,6 +9,7 @@
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
#include <ntoskrnl.h>
|
#include <ntoskrnl.h>
|
||||||
|
#include <ntintsafe.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
@ -2847,6 +2848,7 @@ MmMapViewOfArm3Section(IN PVOID SectionObject,
|
||||||
PCONTROL_AREA ControlArea;
|
PCONTROL_AREA ControlArea;
|
||||||
ULONG ProtectionMask;
|
ULONG ProtectionMask;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
ULONG64 CalculatedViewSize;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Get the segment and control area */
|
/* Get the segment and control area */
|
||||||
|
@ -2893,11 +2895,12 @@ MmMapViewOfArm3Section(IN PVOID SectionObject,
|
||||||
if (!(*ViewSize))
|
if (!(*ViewSize))
|
||||||
{
|
{
|
||||||
/* Compute it for the caller */
|
/* Compute it for the caller */
|
||||||
*ViewSize = (SIZE_T)(Section->SizeOfSection.QuadPart - SectionOffset->QuadPart);
|
CalculatedViewSize = Section->SizeOfSection.QuadPart -
|
||||||
|
SectionOffset->QuadPart;
|
||||||
|
|
||||||
/* Check if it's larger than 4GB or overflows into kernel-mode */
|
/* Check if it's larger than 4GB or overflows into kernel-mode */
|
||||||
if ((*ViewSize > 0xFFFFFFFF) ||
|
if (!NT_SUCCESS(RtlULongLongToSIZET(CalculatedViewSize, ViewSize)) ||
|
||||||
(((ULONG_PTR)MM_HIGHEST_VAD_ADDRESS - (ULONG_PTR)*BaseAddress) < *ViewSize))
|
(((ULONG_PTR)MM_HIGHEST_VAD_ADDRESS - (ULONG_PTR)*BaseAddress) < CalculatedViewSize))
|
||||||
{
|
{
|
||||||
DPRINT1("Section view won't fit\n");
|
DPRINT1("Section view won't fit\n");
|
||||||
return STATUS_INVALID_VIEW_SIZE;
|
return STATUS_INVALID_VIEW_SIZE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue