Bug 219954 - Missing null check in fme_perf_pmu_register
Summary: Missing null check in fme_perf_pmu_register
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P3 normal
Assignee: drivers_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-28 12:27 UTC by henry
Modified: 2025-03-28 12:27 UTC (History)
0 users

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


Attachments

Description henry 2025-03-28 12:27:43 UTC
fpga: dfl-fme-perf.c
Add NULL check in the fme_perf_pmu_register

When devm_kasprintf() fails, it returns a NULL pointer. However, this return value is not properly checked in the function fme_perf_pmu_register. 

A NULL check should be added after the devm_kasprintf call to handle potential NULL pointer dereference error.

CODE:
	pmu->capabilities =	PERF_PMU_CAP_NO_INTERRUPT |
				PERF_PMU_CAP_NO_EXCLUDE;

	name = devm_kasprintf(priv->dev, GFP_KERNEL, "dfl_fme%d", pdev->id);

	ret = perf_pmu_register(pmu, name, -1);
	if (ret)
		return ret;

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