public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: Replace kzalloc and memcpy by kmemdup
@ 2015-05-20  7:04 Dumbre, Nitesh Dilip (N.)
  2015-05-20  7:54 ` Drokin, Oleg
  2015-05-31  2:35 ` gregkh
  0 siblings, 2 replies; 5+ messages in thread
From: Dumbre, Nitesh Dilip (N.) @ 2015-05-20  7:04 UTC (permalink / raw)
  To: oleg.drokin@intel.com, andreas.dilger@intel.com,
	gregkh@linuxfoundation.org, Julia.Lawall@lip6.fr, joe@perches.com,
	gdonald@gmail.com, akpm@linux-foundation.org,
	rickard_strandqvist@spectrumdigital.se, uja.ornl@gmail.com,
	john.hammond@intel.com, HPDD-discuss@lists.01.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org

This patch was generated by coccicheck and replaces kzalloc followed
by memcpy with kmemdup

Signed-off-by: Nitesh Dumbre <ndumbre@visteon.com>

diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 57c6ddd..c988be4 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1711,13 +1711,12 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
 		goto destroy_new;
 	}
 	/* not found - create */
-	buffer = kzalloc(LNET_NIDSTR_SIZE, GFP_NOFS);
+	buffer = kmemdup(libcfs_nid2str(*nid), LNET_NIDSTR_SIZE, GFP_NOFS);
 	if (buffer == NULL) {
 		rc = -ENOMEM;
 		goto destroy_new;
 	}
 
-	memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE);
 	new_stat->nid_proc = lprocfs_register(buffer,
 					      obd->obd_proc_exports_entry,
 					      NULL, NULL);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-31 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-20  7:04 [PATCH] staging: Replace kzalloc and memcpy by kmemdup Dumbre, Nitesh Dilip (N.)
2015-05-20  7:54 ` Drokin, Oleg
2015-05-31  2:35 ` gregkh
2015-05-31 13:13   ` Joe Perches
2015-05-31 20:56     ` gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox