Bug 219948 - Missing null check in tps6594_pfsm_probe
Summary: Missing null check in tps6594_pfsm_probe
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Platform (show other bugs)
Hardware: All Linux
: P3 normal
Assignee: drivers_platform@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-28 10:40 UTC by henry
Modified: 2025-03-28 10:40 UTC (History)
0 users

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description henry 2025-03-28 10:40:52 UTC
misc: tps6594-pfsm: Add null check in the tps6594_pfsm_probe

When devm_kasprintf fails, it returns a null pointer. However, this return value is not properly checked in the function tps6594_pfsm_probe. 

A check should be added after the devm_kasprintf call to prevent potential null pointer dereference issues.

CODE:
	pfsm->miscdev.minor = MISC_DYNAMIC_MINOR;
	pfsm->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "pfsm-%ld-0x%02x",
					    tps->chip_id, tps->reg);
	pfsm->miscdev.fops = &tps6594_pfsm_fops;
	pfsm->miscdev.parent = dev->parent;

Note You need to log in before you can comment on or make changes to this bug.