mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: "Dighe, Niranjan (N.)" <ndighe@visteon.com>
Cc: "oleg.drokin@intel.com" <oleg.drokin@intel.com>,
	"andreas.dilger@intel.com" <andreas.dilger@intel.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"Julia.Lawall@lip6.fr" <Julia.Lawall@lip6.fr>,
	"gdonald@gmail.com" <gdonald@gmail.com>,
	"rd@radekdostal.com" <rd@radekdostal.com>,
	"uja.ornl@gmail.com" <uja.ornl@gmail.com>,
	"joe@perches.com" <joe@perches.com>,
	"HPDD-discuss@lists.01.org" <HPDD-discuss@ml01.01.org>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Staging: lustre: Replace kzalloc followed by memcpy with kmemdup
Date: Sat, 30 May 2015 14:31:31 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1505301431050.2314@hadrien> (raw)
In-Reply-To: <20150530102211.GA12727@codebox>



On Sat, 30 May 2015, Dighe, Niranjan (N.) wrote:

> Replace kzalloc followed by memcpy by kmemdup. This patch was generated
> by 'make coccicheck'
>
> Signed-off-by: Niranjan Dighe <ndighe@visteon.com>

You need a --- here.  Also it is nice to put a diffstat below.

julia

>
> diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c
> index 0bda9c5..274cae3 100644
> --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
> +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
> @@ -866,29 +866,26 @@ int class_add_profile(int proflen, char *prof, int osclen, char *osc,
>  	INIT_LIST_HEAD(&lprof->lp_list);
>
>  	LASSERT(proflen == (strlen(prof) + 1));
> -	lprof->lp_profile = kzalloc(proflen, GFP_NOFS);
> +	lprof->lp_profile = kmemdup(prof, proflen, GFP_NOFS);
>  	if (lprof->lp_profile == NULL) {
>  		err = -ENOMEM;
>  		goto free_lprof;
>  	}
> -	memcpy(lprof->lp_profile, prof, proflen);
>
>  	LASSERT(osclen == (strlen(osc) + 1));
> -	lprof->lp_dt = kzalloc(osclen, GFP_NOFS);
> +	lprof->lp_dt = kmemdup(osc, osclen, GFP_NOFS);
>  	if (lprof->lp_dt == NULL) {
>  		err = -ENOMEM;
>  		goto free_lp_profile;
>  	}
> -	memcpy(lprof->lp_dt, osc, osclen);
>
>  	if (mdclen > 0) {
>  		LASSERT(mdclen == (strlen(mdc) + 1));
> -		lprof->lp_md = kzalloc(mdclen, GFP_NOFS);
> +		lprof->lp_md = kmemdup(mdc, mdclen, GFP_NOFS);
>  		if (lprof->lp_md == NULL) {
>  			err = -ENOMEM;
>  			goto free_lp_dt;
>  		}
> -		memcpy(lprof->lp_md, mdc, mdclen);
>  	}
>
>  	list_add(&lprof->lp_list, &lustre_profile_list);
> --
> 1.9.1
>

  reply	other threads:[~2015-05-30 12:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-30 10:22 Dighe, Niranjan (N.)
2015-05-30 12:31 ` Julia Lawall [this message]
2015-05-31  2:30 ` gregkh
2015-05-30 14:49 Dighe, Niranjan (N.)
2015-05-30 14:54 Dighe, Niranjan (N.)
2015-05-31  5:28 Dighe, Niranjan (N.)

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=alpine.DEB.2.10.1505301431050.2314@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=HPDD-discuss@ml01.01.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gdonald@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ndighe@visteon.com \
    --cc=oleg.drokin@intel.com \
    --cc=rd@radekdostal.com \
    --cc=uja.ornl@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

all inboxes | Powered by JetHome®