Staging: lustre: Replace kzalloc and memcpy by kmemdup
authorGunasundar, Balamanikandan (B.) <bgunasun@visteon.com>
Tue, 12 May 2015 10:35:52 +0000 (10:35 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 00:19:36 +0000 (09:19 +0900)
This patch was generated by 'make coccicheck'

Signed-off-by: Balamanikandan Gunasundar <bgunasun@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c

index 57c6ddd95f3eb16cac2fe5f9457e386c449609bd..c988be4fc04930c9d3152a540bedd3190d591c8b 100644 (file)
@@ -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);