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

Prevent pointer to an out-of-scope local variable #8940

Merged
merged 1 commit into from
Jun 21, 2019

Conversation

kusumi
Copy link
Member

@kusumi kusumi commented Jun 20, 2019

Motivation and Context

#8924

Description

show_str could be a pointer to a local variable in stack which is out-of-scope by the time
return (snprintf(buf, buflen, "%s\n", show_str));
is called.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

`show_str` could be a pointer to a local variable in stack
which is out-of-scope by the time
`return (snprintf(buf, buflen, "%s\n", show_str));`
is called.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Jun 20, 2019
@behlendorf behlendorf requested a review from tonyhutter June 20, 2019 19:49
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Jun 20, 2019
@behlendorf behlendorf merged commit 9585497 into openzfs:master Jun 21, 2019
@codecov
Copy link

codecov bot commented Jun 21, 2019

Codecov Report

Merging #8940 into master will decrease coverage by 0.39%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #8940     +/-   ##
=========================================
- Coverage   78.86%   78.47%   -0.4%     
=========================================
  Files         388      388             
  Lines      120055   120054      -1     
=========================================
- Hits        94683    94208    -475     
- Misses      25372    25846    +474
Flag Coverage Δ
#kernel 79.44% <ø> (-0.09%) ⬇️
#user 65.86% <ø> (-0.96%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 050d720...c39c122. Read the comment docs.

tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Aug 13, 2019
`show_str` could be a pointer to a local variable in stack
which is out-of-scope by the time
`return (snprintf(buf, buflen, "%s\n", show_str));`
is called.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes openzfs#8924
Closes openzfs#8940
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Aug 22, 2019
`show_str` could be a pointer to a local variable in stack
which is out-of-scope by the time
`return (snprintf(buf, buflen, "%s\n", show_str));`
is called.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes openzfs#8924
Closes openzfs#8940
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Aug 23, 2019
`show_str` could be a pointer to a local variable in stack
which is out-of-scope by the time
`return (snprintf(buf, buflen, "%s\n", show_str));`
is called.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes openzfs#8924
Closes openzfs#8940
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Sep 17, 2019
`show_str` could be a pointer to a local variable in stack
which is out-of-scope by the time
`return (snprintf(buf, buflen, "%s\n", show_str));`
is called.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes openzfs#8924
Closes openzfs#8940
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Sep 18, 2019
`show_str` could be a pointer to a local variable in stack
which is out-of-scope by the time
`return (snprintf(buf, buflen, "%s\n", show_str));`
is called.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes openzfs#8924
Closes openzfs#8940
tonyhutter pushed a commit that referenced this pull request Sep 26, 2019
`show_str` could be a pointer to a local variable in stack
which is out-of-scope by the time
`return (snprintf(buf, buflen, "%s\n", show_str));`
is called.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes #8924
Closes #8940
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants