Skip to contentSkip to conversation

ANDROID: Incremental fs: fix memdup.cocci warnings

PATCH New Julia Lawall 1 participant 1 message Feb 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ANDROID: Incremental fs: fix memdup.cocci warnings

From: kbuild test robot <[email protected]>

Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes 2dbb0451810f ("ANDROID: Incremental fs: Support xattrs")

---

tree:   https://android.googlesource.com/kernel/common android-mainline
head:   2dbb0451810f9e63c61e974cbc490f3b75384b63
commit: 2dbb0451810f9e63c61e974cbc490f3b75384b63 [1/1] ANDROID: Incremental fs: Support xattrs

:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago

 vfs.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/incfs/vfs.c +1 -2
@@ -2118,11 +2118,10 @@ static ssize_t incfs_setxattr(struct den
 	}
 
 	kfree (*stored_value);
-	*stored_value = kzalloc(size, GFP_NOFS);
+	*stored_value = kmemdup(value, size, GFP_NOFS);
 	if (!*stored_value)
 		return -ENOMEM;
 
-	memcpy(*stored_value, value, size);
 	*stored_size = size;
 	return 0;
 }