Skip to content

Fix uninitialized variable issue - #11440

Merged
Nir-Az merged 4 commits into
realsenseai:developmentfrom
Tamir91:kw_development_validation
Feb 16, 2023
Merged

Nir-Az merged 4 commits into
realsenseai:developmentfrom
Tamir91:kw_development_validation

Conversation

@Tamir91

@Tamir91 Tamir91 commented Feb 15, 2023 •

Copy link
Copy Markdown
Contributor

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

@Tamir91
Tamir91 requested a review from OhadMeir February 15, 2023 13:32
Comment thread src/ds/ds-options.cpp Outdated
LOG_ERROR(_ep.get_option_name(_option) << " value is not valid!");

return temperature_data.*field;
float temperature_val = temperature_data.*field;

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 fix did not solve the error...
May we mark it as not a problem?

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.

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@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

@Nir-Az
Nir-Az merged commit 7524d76 into realsenseai: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.

3 participants