Fix the potential secure issues from static code scan by wcwang · Pull Request #313 · intel/haxm (original) (raw)

This repository was archived by the owner on Jan 28, 2023. It is now read-only.

Conversation1 Commits4 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

wcwang

After the security check of the static code scanning tool Coverity, these security patches are made based on the scan results.

@wcwang

The return value of MmGetMdlPfnArray() cannot be NULL according to the macro definition. The condition judgement statement will never be true. Remove the dead code according to the analysis result of Coverity.

Signed-off-by: Wenchao Wang wenchao.wang@intel.com

@wcwang

HAX_MEM_PAGABLE and HAX_MEM_NONPAGE are mutually exclusive flags. It will be strict to use else if instead of if. Optimize the code according to the analysis result of Coverity.

Signed-off-by: Wenchao Wang wenchao.wang@intel.com

@wcwang

The potentially overflowing expression with type int is used to assign to an expression of type uint64_t. Correct the code according to the analysis result of Coverity.

Signed-off-by: Wenchao Wang wenchao.wang@intel.com

@wcwang

Comment out the unreachable code according to the analysis result of Coverity.

Signed-off-by: Wenchao Wang wenchao.wang@intel.com

coxuintel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.