public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Shreeya Patel <shreeya.patel23498@gmail.com>
Cc: oleg.drokin@intel.com, andreas.dilger@intel.com,
	jsimmons@infradead.org, lustre-devel@lists.lustre.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: lustre: Use kmemdup() instead of kzalloc and memcpy
Date: Sun, 17 Jun 2018 13:22:03 +0200	[thread overview]
Message-ID: <20180617112203.GA9357@kroah.com> (raw)
In-Reply-To: <1529234215-4010-1-git-send-email-shreeya.patel23498@gmail.com>

On Sun, Jun 17, 2018 at 04:46:55PM +0530, Shreeya Patel wrote:
> Replace calls to kzalloc or kmalloc followed by a memcpy with
> a direct call to kmemdup to shorten the code.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> expression from,to,size,flag;
> statement S;
> @@
> 
> -  to = \(kmalloc\|kzalloc\)(size,flag);
> +  to = kmemdup(from,size,flag);
>    if (to==NULL || ...) S
> -  memcpy(to, from, size);
> 
> Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
> ---
>  drivers/staging/lustre/lnet/lnet/api-ni.c | 5 ++---

Always work off of the latest kernel tree.  Ideally linux-next or the
staging.git staging-next tree.  Worse case, Linus's tree.  But never off
of an old kernel tree, that will only cause you to duplicate work that
others have done :(

Please resync against 4.18-rc1 and see why I say this when trying to
apply your patch...

thanks,

greg k-h

      reply	other threads:[~2018-06-17 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-17 11:16 [PATCH] Staging: lustre: Use kmemdup() instead of kzalloc and memcpy Shreeya Patel
2018-06-17 11:22 ` Greg KH [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=20180617112203.GA9357@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    --cc=shreeya.patel23498@gmail.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