[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170624210224.GA140192@lkp-ib03.lkp.intel.com>
Date: Sun, 25 Jun 2017 05:02:24 +0800
From: kbuild test robot <lkp@...el.com>
To: Stefan Berger <stefanb@...ux.vnet.ibm.com>
Cc: kbuild-all@...org, ebiederm@...ssion.com,
containers@...ts.linux-foundation.org, lkp@...org,
xiaolong.ye@...el.com, linux-kernel@...r.kernel.org,
zohar@...ux.vnet.ibm.com, serge@...lyn.com, tycho@...ker.com,
James.Bottomley@...senPartnership.com,
christian.brauner@...lbox.org, stefanb@...ux.vnet.ibm.com,
vgoyal@...hat.com, amir73il@...il.com,
linux-security-module@...r.kernel.org
Subject: [PATCH] xattr: fix kstrdup.cocci warnings
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 <stefanb@...ux.vnet.ibm.com>
Signed-off-by: Fengguang Wu <fengguang.wu@...el.com>
---
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;
Powered by blists - more mailing lists