Staging: lustre: Replace kzalloc followed by memcpy with kmemdup
PATCH 1/1 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 <[email protected]>
drivers/staging/lustre/lustre/obdclass/obd_config.c +3 -6
@@ -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);
Signature · 1 line
1.9.1
Quoted 4 lines · Niranjan (N.)
Replace kzalloc followed by memcpy by kmemdup. This patch was generated by 'make coccicheck'
Signed-off-by Niranjan Dighe <[email protected]>
You need a --- here. Also it is nice to put a diffstat below.
julia
Quoted 41 lines
drivers/staging/lustre/lustre/obdclass/obd_config.c +3
-7@@ -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
[email protected]
maintainerQuoted 4 lines · Niranjan (N.)
Replace kzalloc followed by memcpy by kmemdup. This patch was generated by 'make coccicheck'
Signed-off-by Niranjan Dighe <[email protected]>
Your name here doesn't match the name in the From: line of your email.
Please fix up your email client for all of the patches you sent me and resend.
thanks,
greg k-h