From: "Dighe, Niranjan (N.)" <ndighe@visteon.com>
To: "Julia.Lawall@lip6.fr" <Julia.Lawall@lip6.fr>
Cc: "oleg.drokin@intel.com" <oleg.drokin@intel.com>,
"andreas.dilger@intel.com" <andreas.dilger@intel.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"gdonald@gmail.com" <gdonald@gmail.com>,
"rd@radekdostal.com" <rd@radekdostal.com>,
"Dighe, Niranjan (N.)" <ndighe@visteon.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: [PATCH] Staging: lustre: Replace kzalloc followed by memcpy with kmemdup
Date: Sat, 30 May 2015 14:54:35 +0000 [thread overview]
Message-ID: <20150530145349.GA14700@codebox> (raw)
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
next reply other threads:[~2015-05-30 14:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-30 14:54 Dighe, Niranjan (N.) [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-05-31 5:28 [PATCH] Staging: lustre: Replace kzalloc followed by memcpy with kmemdup Dighe, Niranjan (N.)
2015-05-30 14:49 Dighe, Niranjan (N.)
2015-05-30 10:22 Dighe, Niranjan (N.)
2015-05-30 12:31 ` Julia Lawall
2015-05-31 2:30 ` gregkh
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=20150530145349.GA14700@codebox \
--to=ndighe@visteon.com \
--cc=HPDD-discuss@ml01.01.org \
--cc=Julia.Lawall@lip6.fr \
--cc=alpine.DEB.2.10.1505301431050.2314@hadrien \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.