Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add NULL-check platform_data before dereferencing in devicemodel_probe#363

Open
EricccTaiwan wants to merge 1 commit intosysprog21:masterfrom
EricccTaiwan:master
Open

Add NULL-check platform_data before dereferencing in devicemodel_probe#363
EricccTaiwan wants to merge 1 commit intosysprog21:masterfrom
EricccTaiwan:master

Conversation

Copy link
Collaborator

EricccTaiwan commented Mar 6, 2026 *
edited by cubic-dev-ai bot
Loading

dev->dev.platform_data is optional and not guaranteed to be set by the platform device registrar. Add a NULL guard and return -EINVAL to fail the probe cleanly instead of crashing the kernel with a NULL dereference.


Summary by cubic

Add a NULL check for platform_data in devicemodel_probe to prevent a NULL dereference and kernel crash. If platform data is missing, log an error and return -EINVAL to fail the probe cleanly.

Written for commit 1d3a336. Summary will update on new commits.

dev->dev.platform_data is optional and not guaranteed to be set by the
platform device registrar. Add a NULL guard and return -EINVAL to fail
the probe cleanly instead of crashing the kernel with a NULL dereference.

Signed-off-by: Cheng-Yang Chou
cubic-dev-ai bot reviewed Mar 6, 2026
Copy link

cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

EricccTaiwan requested review from jserv and visitorckw March 6, 2026 07:46
Copy link
Collaborator

visitorckw commented Mar 6, 2026

To better justify this change, could you please clarify what are the specific conditions or execution paths that would trigger a NULL platform_data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

cubic-dev-ai[bot] cubic-dev-ai[bot] left review comments

jserv Awaiting requested review from jserv

visitorckw Awaiting requested review from visitorckw

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants