[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b1e7330-f4f6-47f8-a568-eaea1624bb6f@web.de>
Date: Tue, 26 Dec 2023 10:38:22 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: dri-devel@...ts.freedesktop.org, kernel-janitors@...r.kernel.org,
Daniel Vetter <daniel@...ll.ch>, David Airlie <airlied@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: [PATCH 1/3] drm: property: One function call less in
drm_property_create() after error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
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@...rs.sourceforge.net>
---
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
Powered by blists - more mailing lists