lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20150530145349.GA14700@codebox>
Date:	Sat, 30 May 2015 14:54:35 +0000
From:	"Dighe, Niranjan (N.)" <ndighe@...teon.com>
To:	"Julia.Lawall@...6.fr" <Julia.Lawall@...6.fr>
CC:	"oleg.drokin@...el.com" <oleg.drokin@...el.com>,
	"andreas.dilger@...el.com" <andreas.dilger@...el.com>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"gdonald@...il.com" <gdonald@...il.com>,
	"rd@...ekdostal.com" <rd@...ekdostal.com>,
	"Dighe, Niranjan (N.)" <ndighe@...teon.com>,
	"uja.ornl@...il.com" <uja.ornl@...il.com>,
	"joe@...ches.com" <joe@...ches.com>,
	"HPDD-discuss@...ts.01.org" <HPDD-discuss@...ts.01.org>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] Staging: lustre: Replace kzalloc followed by memcpy with
 kmemdup

Replace kzalloc followed by memcpy by kmemdup. This patch was generated
by 'make coccicheck'

Signed-off-by: Niranjan Dighe <ndighe@...teon.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ