From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Tue, 26 Dec 2023 08:44:37 +0100 The kfree() function was called in one case by the drm_property_create() function during error handling even if the passed data structure member contained a null pointer. This issue was detected by using the Coccinelle software. Thus use another label. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/drm_property.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index 596272149a35..3440f4560e6e 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -117,7 +117,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, property->values = kcalloc(num_values, sizeof(uint64_t), GFP_KERNEL); if (!property->values) - goto fail; + goto free_property; } ret = drm_mode_object_add(dev, &property->base, DRM_MODE_OBJECT_PROPERTY); @@ -135,6 +135,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, return property; fail: kfree(property->values); +free_property: kfree(property); return NULL; } -- 2.43.0