Skip to content

fix coverity issue - CID 395489: Null pointer dereferences#8278

Merged
maxzhen merged 2 commits intoXilinx:masterfrom
maxzhen:cov
Jul 9, 2024
Merged

fix coverity issue - CID 395489: Null pointer dereferences#8278
maxzhen merged 2 commits intoXilinx:masterfrom
maxzhen:cov

Conversation

@maxzhen
Copy link
Collaborator

@maxzhen maxzhen commented Jul 9, 2024

Problem solved by the commit

Fixing coverity issue: CID 395489: Null pointer dereferences (FORWARD_NULL)

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

Introduced by PR#8272

How problem was solved, alternative solutions (if any) and why they were rejected

Throw in case inst is nullptr, instead of dereferencing it.

@maxzhen maxzhen requested a review from stsoe as a code owner July 9, 2024 03:13
Copy link
Collaborator

@stsoe stsoe left a comment

Choose a reason for hiding this comment

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

Unrelated style comments

@@ -1280,8 +1280,10 @@ patch(const xrt::module& module, uint8_t* ibuf, size_t* sz, const std::vector<st
} else if(hdl->get_os_abi() == Elf_Amd_Aie2ps) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
} else if(hdl->get_os_abi() == Elf_Amd_Aie2ps) {
}
else if (hdl->get_os_abi() == Elf_Amd_Aie2ps) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, sure. Fixed.

throw std::runtime_error{"Only support patching single column"};
throw std::runtime_error{"Patch failed: only support patching single column"};
inst = &instr_buf[0];
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
} else {
}
else {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

@maxzhen maxzhen merged commit 0e7e2c5 into Xilinx:master Jul 9, 2024
@maxzhen maxzhen deleted the cov branch July 10, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants