From: 김승우 <sw0312.kim@samsung.com>
To: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Cc: Inki Dae <inki.dae@samsung.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Kyungmin Park <kyungmin.park@samsung.com>,
sw0312.kim@samsung.com
Subject: Re: [PATCH] drivers: gpu: drm: exynos: Replaced kzalloc & memcpy with kmemdup
Date: Tue, 12 Mar 2013 11:08:26 +0900 [thread overview]
Message-ID: <513E8E1A.9020400@samsung.com> (raw)
In-Reply-To: <1363029923-22122-1-git-send-email-gheorghiuandru@gmail.com>
Good point.
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
On 2013년 03월 12일 04:25, Alexandru Gheorghiu wrote:
> Replaced calls to kzalloc followed by memcpy with call to kmemdup.
> Patch found using coccinelle.
>
> Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
> ---
> drivers/gpu/drm/exynos/exynos_drm_vidi.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> index 13ccbd4..9504b0c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> @@ -117,13 +117,12 @@ static struct edid *vidi_get_edid(struct device *dev,
> }
>
> edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH;
> - edid = kzalloc(edid_len, GFP_KERNEL);
> + edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL);
> if (!edid) {
> DRM_DEBUG_KMS("failed to allocate edid\n");
> return ERR_PTR(-ENOMEM);
> }
>
> - memcpy(edid, ctx->raw_edid, edid_len);
> return edid;
> }
>
> @@ -563,12 +562,11 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
> return -EINVAL;
> }
> edid_len = (1 + raw_edid->extensions) * EDID_LENGTH;
> - ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL);
> + ctx->raw_edid = kmemdup(raw_edid, edid_len, GFP_KERNEL);
> if (!ctx->raw_edid) {
> DRM_DEBUG_KMS("failed to allocate raw_edid.\n");
> return -ENOMEM;
> }
> - memcpy(ctx->raw_edid, raw_edid, edid_len);
> } else {
> /*
> * with connection = 0, free raw_edid
>
--
Seung-Woo Kim
Samsung Software R&D Center
--
next prev parent reply other threads:[~2013-03-12 2:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-11 19:25 [PATCH] drivers: gpu: drm: exynos: Replaced kzalloc & memcpy with kmemdup Alexandru Gheorghiu
2013-03-12 2:08 ` 김승우 [this message]
2013-03-12 4:12 ` Inki Dae
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=513E8E1A.9020400@samsung.com \
--to=sw0312.kim@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gheorghiuandru@gmail.com \
--cc=inki.dae@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
/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