Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2024

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.

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
17 checks passed
@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