none
Unexpected Code Analysis behavior RRS feed

  • Question

  • I'm receiving "warning C30029: Warning: A call was made to MmMapIoSpace(). This allocates executable memory. If executable memory is not required, please use MmMapIoSpaceEx()" when building kernel driver. While the warning is very self-explanatory, it pops out when I target Windows versions older than Win10, i.e. the MmMapIoSpaceEx isn't available for usage. The code analysis rool set is configured to "Microsoft Driver Recommended Rules". I've also looked into the relevant rule set files and didn't find this warning (C30029) mentioned at all there. Can someone explain where is this warning being enabled and how to mitigate the warning in pre-Win10 builds? (something more elegant than shutting up the compiler with #pragma disable...)
    Tuesday, July 26, 2016 4:20 PM

Answers

  • Basically you are going to have to either create a custom rule set (but as you point out you haven't found the rule set file with the warning), or use the #pragma disable.   While the WDK is designed to support older OS'es the code analysis is tuned to the latest OS, so one way or another you are going to have to disable the rule.   Personally, I would just put the #pragma warning... in the start of the file (or in the common include file if multiple files use MmMapIoSpace) with a comment saying it is there to support pre-Win10 builds.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    • Marked as answer by -IgorC- Tuesday, July 26, 2016 4:51 PM
    Tuesday, July 26, 2016 4:47 PM