Skip to content
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

CR-1160935 : Fixed a issue for xbtest invalid card BDF #7519

Merged
merged 3 commits into from
May 3, 2023

Conversation

saifuddin-xilinx
Copy link
Collaborator

Problem solved by the commit

CR-1160935
xbtest VVT - Issuing an xbtest command with an invalid BDF triggers a segmentation fault

-- This is a minor issue. If we issue an xbtest command such as verify with an invalid bdf, we observe the test failing but with a segmentation_fault

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

N/A

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

-- Added a check before accessing the invalid entry of PCI device vector.

Risks (if any) associated the changes in the commit

N/A

What has been tested and how, request additional testing if necessary

Basic Validation and xbtest

Documentation impact (if any)

N/A

@saifuddin-xilinx saifuddin-xilinx changed the title Fixed a issue for xbtest invalid card BDF CR-1160935 : Fixed a issue for xbtest invalid card BDF Apr 25, 2023
@@ -131,7 +131,8 @@ get_pcidev(unsigned index, bool is_user) const
if (index < user_ready_list.size())
return user_ready_list[index];

return user_nonready_list[index - user_ready_list.size()];
return !user_nonready_list.size() ? NULL :
user_nonready_list[index - user_ready_list.size()];
Copy link
Collaborator

Choose a reason for hiding this comment

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

As discussed, please add a check which covers all cases.

Suggested change
user_nonready_list[index - user_ready_list.size()];
if( index - user_ready_list.size() < user_nonready_list.size() )
return user_nonready_list[index - user_ready_list.size()]
return nullptr;

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 as suggested. Thanks

Signed-off-by: Saifuddin <saifuddi@xilinx.com>
@gbuildx
Copy link
Collaborator

gbuildx commented Apr 25, 2023

Build Failed! :(

@chvamshi-xilinx
Copy link
Collaborator

retest this please

@gbuildx
Copy link
Collaborator

gbuildx commented Apr 25, 2023

Build Failed! :(

@dayeh-xilinx
Copy link

retest this please.

@gbuildx
Copy link
Collaborator

gbuildx commented Apr 25, 2023

Build Failed! :(

@dayeh-xilinx
Copy link

retest this please.

@gbuildx
Copy link
Collaborator

gbuildx commented Apr 26, 2023

Build Failed! :(

@dayeh-xilinx
Copy link

retest this please.

@gbuildx
Copy link
Collaborator

gbuildx commented Apr 26, 2023

Build Failed! :(

@dayeh-xilinx
Copy link

retest this please.

2 similar comments
@dayeh-xilinx
Copy link

retest this please.

@dayeh-xilinx
Copy link

retest this please.

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.

Same problem exist for mgmt.
I would suggest using std::vector::at(idx) for bounds checking when it can be off.
If you wrap the function body in

try {
  ...
}
catch (const std::exception&) {
  return nullptr;
}

then both cases will be handle.

@@ -131,7 +131,10 @@ get_pcidev(unsigned index, bool is_user) const
if (index < user_ready_list.size())
return user_ready_list[index];

return user_nonready_list[index - user_ready_list.size()];
if ((index - user_ready_list.size()) < user_nonready_list.size())
return user_nonready_list[index - user_ready_list.size()];
Copy link
Collaborator

@stsoe stsoe Apr 28, 2023

Choose a reason for hiding this comment

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

Suggested change
return user_nonready_list[index - user_ready_list.size()];
return user_nonready_list.at(index - user_ready_list.size());

WIth try catch. Do same for mgmt. And no need for conditional if.

Signed-off-by: Saifuddin <saifuddi@xilinx.com>
@gbuildx
Copy link
Collaborator

gbuildx commented May 2, 2023

Build failed :(

@manikandan-xilinx
Copy link
Collaborator

retest this please.

@gbuildx
Copy link
Collaborator

gbuildx commented May 3, 2023

Build Passed!

@chvamshi-xilinx chvamshi-xilinx merged commit e5ba80c into Xilinx:master May 3, 2023
chvamshi-xilinx pushed a commit to chvamshi-xilinx/XRT-1 that referenced this pull request May 3, 2023
* Fixed a issue for xbtest invalid card BDF

* Fixed a issue for xbtest invalid card BDF

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* incorporate review comments

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

---------

Signed-off-by: Saifuddin <saifuddi@xilinx.com>
(cherry picked from commit e5ba80c)
chvamshi-xilinx pushed a commit that referenced this pull request May 3, 2023
* CR-1160935 : Fixed a issue for xbtest invalid card BDF (#7519)

* Fixed a issue for xbtest invalid card BDF

* Fixed a issue for xbtest invalid card BDF

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* incorporate review comments

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

---------

Signed-off-by: Saifuddin <saifuddi@xilinx.com>
(cherry picked from commit e5ba80c)

* Fixed xocl driver issues (#7527)

Signed-off-by: Saifuddin <saifuddi@xilinx.com>
(cherry picked from commit 5cc7361)
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.

6 participants