-
Notifications
You must be signed in to change notification settings - Fork 473
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
Conversation
@@ -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()]; |
There was a problem hiding this comment.
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.
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; |
There was a problem hiding this comment.
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>
Build Failed! :( |
retest this please |
Build Failed! :( |
retest this please. |
Build Failed! :( |
retest this please. |
Build Failed! :( |
retest this please. |
Build Failed! :( |
retest this please. |
2 similar comments
retest this please. |
retest this please. |
There was a problem hiding this 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()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
Build failed :( |
retest this please. |
Build Passed! |
* 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)
* 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)
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