Skip to content

Coverity development validation - #12531

Merged
OhadMeir merged 8 commits into
realsenseai:developmentfrom
Tamir91:coverity-development-validation
Dec 24, 2023
Merged

Coverity development validation#12531
OhadMeir merged 8 commits into
realsenseai:developmentfrom
Tamir91:coverity-development-validation

Conversation

@Tamir91

@Tamir91 Tamir91 commented Dec 20, 2023

Copy link
Copy Markdown
Contributor

Tracked on [RSDEV-445]

@Tamir91
Tamir91 requested review from OhadMeir and maloel and removed request for maloel December 20, 2023 13:39
Comment thread src/linux/backend-v4l2.cpp Outdated
@@ -2408,7 +2407,6 @@ namespace librealsense
{
// D457 development - added for mipi device, for IR because no metadata there
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hard to understand the comment here (repeating). Change to:
return; // Does not throw, MIPI device metadata not received through UVC, no metadata here may be valid

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The comments were updated in three places.

Comment thread src/platform/platform-device-info.h Outdated
return d.device_path;
for( auto & d : _group.usb_devices )
return d.id;
if( _group.uvc_devices.size() )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Style comment (you don't have to change if you prefer this style)
I think it is clearer to use if( ! _group.uvc_devices.empty() )
or at least if( _group.uvc_devices.size() > 0 )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I also think that the approach is more elegant and readable.

Comment thread src/platform/platform-device-info.h Outdated
return d.id;
if( _group.uvc_devices.size() )
return _group.uvc_devices.front().device_path;
if( _group.usb_devices.size() )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What was the Coverity complaint here? I see nothing wrong with this code that I wrote :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CID 6053338 (#4 of 4): Structurally dead code (UNREACHABLE) unreachable: Since the loop increment ++<anonymous>; is unreachable, the loop body will never execute more than once.

I also think that your code is fine, but Tamir's change keeps the original logic and suppresses the warning.
If you have objections we can consider marking this issue as ignore. It will keep showing in the reports but will not count as a reason to fail the security SWRC

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What a waste of time...

@Tamir91
Tamir91 requested a review from OhadMeir December 21, 2023 12:37

@OhadMeir OhadMeir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@OhadMeir
OhadMeir merged commit 4265f7a into realsenseai:development Dec 24, 2023
@Tamir91
Tamir91 deleted the coverity-development-validation branch February 6, 2024 09:18
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.

3 participants