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

Remove possible nil pointer dereference in mkdir #226

Merged
merged 2 commits into from
Nov 7, 2023
Merged

Conversation

cbartoszDell
Copy link
Contributor

@cbartoszDell cbartoszDell commented Oct 23, 2023

Description

There was a possibility for nil pointer dereference on os.Stat result. This is now fixed. Also refactored the function so there is less nesting and happy path is the default.

dell/csm#1014

Checklist:

  • I have performed a self-review of my own code to ensure there are no formatting, vetting, linting, or security issues
  • I have verified that new and existing unit tests pass locally with my changes
  • I have not allowed coverage numbers to degenerate
  • I have maintained at least 90% code coverage
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Backward compatibility is not broken

How Has This Been Tested?

I have crated test cases for all but one path in the function, because I haven't found a way to trigger fs errors other than fs.ErrNotFound easily. The logic is pretty simple so it should be correct.

Copy link
Contributor

@gallacher gallacher left a comment

Choose a reason for hiding this comment

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

Is this a fix related to a GitHub bug? Or part of feature implementation? Please associate this PR with a GitHub issue. Thanks.

Copy link
Contributor

@gallacher gallacher left a comment

Choose a reason for hiding this comment

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

Is this code change fixing a defect? Please associate it with a GitHub issue. Thanks.

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.

4 participants