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

Fix uninitialized variable issue #11440

Merged
merged 4 commits into from Feb 16, 2023

Conversation

Tamir91
Copy link
Contributor

@Tamir91 Tamir91 commented Feb 15, 2023

Tracked on [LRS-670]
Tracked on [LRS-671]

@@ -86,7 +86,8 @@ namespace librealsense
if (0 == temperature_data.*is_valid_field)
LOG_ERROR(_ep.get_option_name(_option) << " value is not valid!");

return temperature_data.*field;
float temperature_val = temperature_data.*field;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fix did not solve the error...
May we mark it as not a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Nir-Az, please advise if we may mark it like "Not a problem".
I checked via debugger that a value was temperature_val = 37.000000

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add the static analysis complaint ..

Copy link
Collaborator

Choose a reason for hiding this comment

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

return static_cast<float>(temperature_data.*field) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure this will work but it's worth a shot...
The field value is casted to float anyway but it seems that KW does not interpret .* as dereferencing the pointer-to-member. Maybe an explicit cast will help, but we tried setting that into a value that is returned in a different statement, and it didn't help.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the static analysis complaint ..

See LRS-670 (number 2 in the description)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Whatever you think, if you wish to mark as Not a problem, feel free (on master+ development KW projects.
Or maybe the static cast will help

Copy link
Contributor

Choose a reason for hiding this comment

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

So @Tamir91, undo the change and mark it as not a problem.

Copy link
Contributor

@OhadMeir OhadMeir left a comment

Choose a reason for hiding this comment

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

LGTM

@Nir-Az Nir-Az merged commit 7524d76 into IntelRealSense:development Feb 16, 2023
@Nir-Az Nir-Az changed the title KW critical error - Uninitialized Variable - possible in ds-options.cpp Fix uninitialized variable issue Feb 16, 2023
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.

None yet

3 participants