Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933269AbbLVQRn (ORCPT ); Tue, 22 Dec 2015 11:17:43 -0500 Received: from www.osadl.org ([62.245.132.105]:38807 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753071AbbLVQRm (ORCPT ); Tue, 22 Dec 2015 11:17:42 -0500 From: Nicholas Mc Guire To: Mike Marshall Cc: Yi Liu , Martin Brandenburg , linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] Orangefs: use kzalloc for kmalloc + memset 0 Date: Tue, 22 Dec 2015 17:13:50 +0100 Message-Id: <1450800830-9226-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1344 Lines: 41 This is an API consolidation only. The use of kmalloc + memset to 0 should be equivalent to kzalloc in this case. Signed-off-by: Nicholas Mc Guire --- 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(-) diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c index 7319f1a..9eb7972 100644 --- a/fs/orangefs/orangefs-debugfs.c +++ b/fs/orangefs/orangefs-debugfs.c @@ -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, -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/