Skip to contentSkip to conversation

Orangefs: use kzalloc for kmalloc + memset 0

PATCH New Nicholas Mc Guire 1 participant 1 message Dec 22, 2015 Orangefs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Orangefs: use kzalloc for kmalloc + memset 0

This is an API consolidation only. The use of kmalloc + memset to 0 should be equivalent to kzalloc in this case.

---

Found by coccinelle script (relaxed version of scripts/coccinelle/api/alloc/kzalloc-simple.cocci)

Patch was compile tested with: x86_64_defconfig +
CONFIG_ORANGEFS_FS=m

Patch is against linux-next (localversion-next is -next-20151222)

 fs/orangefs/orangefs-debugfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/orangefs/orangefs-debugfs.c +1 -2
index 7319f1a..9eb7972 100644
@@ -365,10 +365,9 @@ static ssize_t orangefs_debug_write(struct file *file,
 		count = ORANGEFS_MAX_DEBUG_STRING_LEN + 1;
 	}
 
-	buf = kmalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
+	buf = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
 	if (!buf)
 		goto out;
-	memset(buf, 0, ORANGEFS_MAX_DEBUG_STRING_LEN);
 
 	if (copy_from_user(buf, ubuf, count - 1)) {
 		gossip_debug(GOSSIP_DEBUGFS_DEBUG,
Signature · 1 line
2.1.4