[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20151221110122.GA47014@athens>
Date: Mon, 21 Dec 2015 19:01:22 +0800
From: kbuild test robot <fengguang.wu@...el.com>
To: Mike Marshall <hubcap@...ibond.com>
Cc: kbuild-all@...org, Martin Brandenburg <martin@...ibond.com>,
Yi Liu <yi9@...mson.edu>, linux-kernel@...r.kernel.org
Subject: [PATCH] Orangefs: fix kzalloc-simple.cocci warnings
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@...el.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,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists