* [PATCH] Orangefs: fix kzalloc-simple.cocci warnings
[not found] <201512211910.teuN6utM%fengguang.wu@intel.com>
@ 2015-12-21 11:01 ` kbuild test robot
0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2015-12-21 11:01 UTC (permalink / raw)
To: Mike Marshall; +Cc: kbuild-all, Martin Brandenburg, Yi Liu, linux-kernel
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 <fengguang.wu@intel.com>
---
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,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-12-21 11:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <201512211910.teuN6utM%fengguang.wu@intel.com>
2015-12-21 11:01 ` [PATCH] Orangefs: fix kzalloc-simple.cocci warnings kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.