[PATCH] Orangefs: fix kzalloc-simple.cocci warnings

2015-12-21 Thread kbuild test robot
fs/orangefs/orangefs-debugfs.c:368:7-14: WARNING: kzalloc should be used for 
buf, instead of kmalloc/memset


 Use kzalloc rather than kmalloc followed by memset with 0

 This considers some simple cases that are common and easy to validate
 Note in particular that there are no ...s in the rule, so all of the
 matched code has to be contiguous

Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci

Signed-off-by: Fengguang Wu 
---

 orangefs-debugfs.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -365,10 +365,9 @@ static ssize_t orangefs_debug_write(stru
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,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Orangefs: fix kzalloc-simple.cocci warnings

2015-12-21 Thread kbuild test robot
fs/orangefs/orangefs-debugfs.c:368:7-14: WARNING: kzalloc should be used for 
buf, instead of kmalloc/memset


 Use kzalloc rather than kmalloc followed by memset with 0

 This considers some simple cases that are common and easy to validate
 Note in particular that there are no ...s in the rule, so all of the
 matched code has to be contiguous

Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci

Signed-off-by: Fengguang Wu 
---

 orangefs-debugfs.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -365,10 +365,9 @@ static ssize_t orangefs_debug_write(stru
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,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/