Skip to content

pmdasmart: fix Coverity FORWARD_NULL and TOCTOU warnings - #2707

Merged
natoscott merged 1 commit into
performancecopilot:mainfrom
pauljevans:pevans-merge
Sep 6, 2026
Merged

pmdasmart: fix Coverity FORWARD_NULL and TOCTOU warnings#2707
natoscott merged 1 commit into
performancecopilot:mainfrom
pauljevans:pevans-merge

Conversation

@pauljevans

Copy link
Copy Markdown
Collaborator

Fix two Coverity defects introduced in the sysfs enumeration change (commit 56d3561)

Fix both warnings from Coverity from the recent pmdasmart changes
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 5b9210d1-ef32-406d-99f2-3d1c222f20ca

📥 Commits

Reviewing files that changed from the base of the PR and between 17a2b81 and 90d3f74.

📒 Files selected for processing (1)
  • src/pmdas/smart/pmda.c

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of disk partitions during device discovery.
    • Prevented unnecessary sorting when no devices are detected.

Walkthrough

The SMART PMDA now detects partitions by opening the sysfs partition attribute. It also skips qsort when device enumeration finds no devices.

Changes

SMART device enumeration

Layer / File(s) Summary
Device filtering and sorting safeguards
src/pmdas/smart/pmda.c
The partition check uses fopen and skips devices when the attribute opens successfully. The device list is sorted only when at least one device exists.

Poem

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

Merge Risk: ⚪ Minimal · up to 90d3f

SMART device enumeration now safely identifies partitions and avoids sorting an empty device list. The change addresses the reported safeguards with no remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the affected component and the two Coverity defects addressed by the changes.
Description check ✅ Passed The description directly explains that the pull request fixes two Coverity defects introduced by the earlier sysfs enumeration change.
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.

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

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

@natoscott
natoscott merged commit 8ee2401 into performancecopilot:main Sep 6, 2026
17 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