From: "Dighe, Niranjan (N.)" <ndighe@visteon.com>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"HPDD-discuss@lists.01.org" <HPDD-discuss@ml01.01.org>,
"andreas.dilger@intel.com" <andreas.dilger@intel.com>,
"gdonald@gmail.com" <gdonald@gmail.com>,
"uja.ornl@gmail.com" <uja.ornl@gmail.com>,
"rd@radekdostal.com" <rd@radekdostal.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"oleg.drokin@intel.com" <oleg.drokin@intel.com>,
"Julia.Lawall@lip6.fr" <Julia.Lawall@lip6.fr>,
"joe@perches.com" <joe@perches.com>
Subject: [PATCH v2] Staging: lustre: Replace kzalloc followed by memcpy with kmemdup
Date: Sun, 31 May 2015 05:39:07 +0000 [thread overview]
Message-ID: <20150531053902.GA3100@codebox> (raw)
From: Niranjan Dighe <ndighe@visteon.com>
Replace kzalloc followed by memcpy by kmemdup. This patch was generated
by 'make coccicheck'
Signed-off-by: Niranjan Dighe <ndighe@visteon.com>
---
drivers/staging/lustre/lustre/obdclass/obd_config.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
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-31 5:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20150531053902.GA3100@codebox \
--to=ndighe@visteon.com \
--cc=20150531052817.GA3043@codebox \
--cc=HPDD-discuss@ml01.01.org \
--cc=Julia.Lawall@lip6.fr \
--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=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