From: Markus Elfring <Markus.Elfring@web.de>
To: dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>
Cc: LKML <linux-kernel@vger.kernel.org>, cocci@inria.fr
Subject: [PATCH 1/3] drm: property: One function call less in drm_property_create() after error detection
Date: Tue, 26 Dec 2023 10:38:22 +0100 [thread overview]
Message-ID: <9b1e7330-f4f6-47f8-a568-eaea1624bb6f@web.de> (raw)
In-Reply-To: <ff7ce5d0-59fa-470c-8dd6-68dbe65c18e5@web.de>
From: Markus Elfring <elfring@users.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@users.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
next prev parent reply other threads:[~2023-12-26 9:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-26 9:36 [PATCH 0/3] drm: property: Adjustments for three function implementations Markus Elfring
2023-12-26 9:38 ` Markus Elfring [this message]
2024-01-03 15:16 ` [PATCH 1/3] drm: property: One function call less in drm_property_create() after error detection Michel Dänzer
2024-01-03 16:24 ` Markus Elfring
2024-01-03 17:18 ` Michel Dänzer
2024-01-03 18:08 ` [1/3] " Markus Elfring
2024-01-04 9:26 ` Michel Dänzer
2024-01-04 12:21 ` Markus Elfring
2024-01-04 15:26 ` [PATCH 1/3] " Dan Carpenter
2023-12-26 9:40 ` [PATCH 2/3] drm: property: Delete an unnecessary initialisation in drm_property_create() Markus Elfring
2023-12-26 9:42 ` [PATCH 3/3] drm: property: Improve four size determinations Markus Elfring
2023-12-26 10:10 ` Simon Ser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9b1e7330-f4f6-47f8-a568-eaea1624bb6f@web.de \
--to=markus.elfring@web.de \
--cc=airlied@gmail.com \
--cc=cocci@inria.fr \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®