Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-13126

ntoskrnl/mm/ARM3/virtual.c, NtFreeVirtualMemory(): rewrite FreeType param checks

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Fix Version/s: 0.4.8
    • Component/s: NTCore
    • Labels:
      None
    • Module:
    • Sprint:
      April 2017, May 2017, June 2017

      Description

      (Noticed while working on CORE-7241.)

      The first check is (partly) broken,
      the second check indentation is misleading.

      NtFreeVirtualMemory()

      5089 NtFreeVirtualMemory(IN HANDLE ProcessHandle,
      5090                     IN PVOID* UBaseAddress,
      5091                     IN PSIZE_T URegionSize,
      5092                     IN ULONG FreeType)
       
      5110     //
      5111     // Only two flags are supported
      5112     //
      5113     if (!(FreeType & (MEM_RELEASE | MEM_DECOMMIT)))
      5114     {
      5115         DPRINT1("Invalid FreeType\n");
      5116         return STATUS_INVALID_PARAMETER_4;
      5117     }
      5118 
      5119     //
      5120     // Check if no flag was used, or if both flags were used
      5121     //
      5122     if (!((FreeType & (MEM_DECOMMIT | MEM_RELEASE))) ||
      5123          ((FreeType & (MEM_DECOMMIT | MEM_RELEASE)) == (MEM_DECOMMIT | MEM_RELEASE)))
      5124     {
      5125         DPRINT1("Invalid FreeType combination\n");
      5126         return STATUS_INVALID_PARAMETER_4;
      5127     }
      

      kmtests/ntos_mm/ZwAllocateVirtualMemory.c
      uses 'MEM_RELEASE' case only.

      We should also add tests for the 4 other cases,
      either there or in a dedicated ZwFreeVirtualMemory.c.

        Attachments

          Activity

            People

            • Assignee:
              ThFabba ThFabba
              Reporter:
              Serge Gautherie Serge Gautherie
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: