Skip to content

utils: Fail early when calling bd_utils_resolve_device with NULL#1196

Merged
vojtechtrefny merged 1 commit intostoraged-project:masterfrom
vojtechtrefny:master_gcc-null-warning-fix
Apr 30, 2026
Merged

utils: Fail early when calling bd_utils_resolve_device with NULL#1196
vojtechtrefny merged 1 commit intostoraged-project:masterfrom
vojtechtrefny:master_gcc-null-warning-fix

Conversation

@vojtechtrefny
Copy link
Copy Markdown
Member

@vojtechtrefny vojtechtrefny commented Apr 29, 2026

gcc static analyzer is complaining about this and the produced error in case is quite cryptic.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced input validation in device utilities to properly handle invalid inputs and improve system stability.

gcc static analyzer is complaining about this and the produced
error in case is quite cryptic.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c7278f2b-fab8-4dc0-98d2-7457f807600d

📥 Commits

Reviewing files that changed from the base of the PR and between 454ce04 and 578b28a.

📒 Files selected for processing (1)
  • src/utils/dev_utils.c

📝 Walkthrough

Walkthrough

The bd_utils_resolve_device function in dev_utils.c now includes input validation that checks if the dev_spec parameter is NULL. When NULL is detected, the function sets a GError and returns NULL, preventing further device resolution logic from executing.

Changes

Cohort / File(s) Summary
Input Validation
src/utils/dev_utils.c
Added NULL check for dev_spec parameter in bd_utils_resolve_device function; sets GError with domain BD_UTILS_DEV_UTILS_ERROR and code BD_UTILS_DEV_UTILS_ERROR_FAILED before returning NULL.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly describes the main change: adding NULL validation to bd_utils_resolve_device to fail early with a proper error message.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@vojtechtrefny vojtechtrefny merged commit 711c764 into storaged-project:master Apr 30, 2026
43 of 44 checks passed
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.

2 participants