From mboxrd@z Thu Jan 1 00:00:00 1970 From: lkp@intel.com (kbuild test robot) Date: Sun, 25 Jun 2017 05:02:24 +0800 Subject: [PATCH] xattr: fix kstrdup.cocci warnings In-Reply-To: <1498157989-11814-2-git-send-email-stefanb@linux.vnet.ibm.com> References: <201706250409.PFosMVWz%fengguang.wu@intel.com> Message-ID: <20170624210224.GA140192@lkp-ib03.lkp.intel.com> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org fs/xattr.c:516:10-17: WARNING opportunity for kstrdep (strcpy on line 519) Use kstrdup rather than duplicating its implementation Generated by: scripts/coccinelle/api/kstrdup.cocci CC: Stefan Berger Signed-off-by: Fengguang Wu --- xattr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/xattr.c +++ b/fs/xattr.c @@ -513,10 +513,9 @@ xattr_userns_name(const char *fullname, return buffer; out_copy: - buffer = kmalloc(strlen(suffix) + 1, GFP_KERNEL); + buffer = kstrdup(suffix, GFP_KERNEL); if (!buffer) return ERR_PTR(-ENOMEM); - strcpy(buffer, suffix); return buffer; -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html