dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sinclair Yeh <syeh@vmware.com>
To: Shyam Saini <mayhs11saini@gmail.com>
Cc: thellstrom@vmware.com, linux-graphics-maintainer@vmware.com,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] gpu: drm: vmwgfx: Use kmemdup instead of kmalloc and memcpy
Date: Thu, 29 Dec 2016 14:49:47 -0800	[thread overview]
Message-ID: <20161229224934.GA17192@vmware.com> (raw)
In-Reply-To: <1482522670-3229-1-git-send-email-mayhs11saini@gmail.com>

Thanks, applied.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>


On Sat, Dec 24, 2016 at 01:21:10AM +0530, Shyam Saini wrote:
> When some other buffer is immediately copied into allocated region.
> Replace calls to kmalloc followed by a memcpy with a direct
> call to kmemdup.
> 
> Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
> index b6126a5..941bcfd 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
> @@ -319,18 +319,17 @@ int vmw_otables_setup(struct vmw_private *dev_priv)
>  	int ret;
>  
>  	if (dev_priv->has_dx) {
> -		*otables = kmalloc(sizeof(dx_tables), GFP_KERNEL);
> +		*otables = kmemdup(dx_tables, sizeof(dx_tables), GFP_KERNEL);
>  		if (*otables == NULL)
>  			return -ENOMEM;
>  
> -		memcpy(*otables, dx_tables, sizeof(dx_tables));
>  		dev_priv->otable_batch.num_otables = ARRAY_SIZE(dx_tables);
>  	} else {
> -		*otables = kmalloc(sizeof(pre_dx_tables), GFP_KERNEL);
> +		*otables = kmemdup(pre_dx_tables, sizeof(pre_dx_tables),
> +				   GFP_KERNEL);
>  		if (*otables == NULL)
>  			return -ENOMEM;
>  
> -		memcpy(*otables, pre_dx_tables, sizeof(pre_dx_tables));
>  		dev_priv->otable_batch.num_otables = ARRAY_SIZE(pre_dx_tables);
>  	}
>  
> -- 
> 2.7.4
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2016-12-30  0:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-23 19:51 [PATCH] gpu: drm: vmwgfx: Use kmemdup instead of kmalloc and memcpy Shyam Saini
2016-12-29 22:49 ` Sinclair Yeh [this message]

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=20161229224934.GA17192@vmware.com \
    --to=syeh@vmware.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=mayhs11saini@gmail.com \
    --cc=thellstrom@vmware.com \
    /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