From: kbuild test robot <fengguang.wu@intel.com>
To: Mike Marshall <hubcap@omnibond.com>
Cc: kbuild-all@01.org, Martin Brandenburg <martin@omnibond.com>,
Yi Liu <yi9@clemson.edu>,
linux-kernel@vger.kernel.org
Subject: [PATCH] Orangefs: fix kzalloc-simple.cocci warnings
Date: Mon, 21 Dec 2015 19:01:22 +0800 [thread overview]
Message-ID: <20151221110122.GA47014@athens> (raw)
In-Reply-To: <201512211910.teuN6utM%fengguang.wu@intel.com>
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,
parent reply other threads:[~2015-12-21 11:02 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <201512211910.teuN6utM%fengguang.wu@intel.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151221110122.GA47014@athens \
--to=fengguang.wu@intel.com \
--cc=hubcap@omnibond.com \
--cc=kbuild-all@01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin@omnibond.com \
--cc=yi9@clemson.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox