From patchwork Thu Aug 9 18:05:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Schumaker X-Patchwork-Id: 1302641 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7F1A83FC23 for ; Thu, 9 Aug 2012 18:06:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756920Ab2HISG0 (ORCPT ); Thu, 9 Aug 2012 14:06:26 -0400 Received: from mx2.netapp.com ([216.240.18.37]:29830 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754952Ab2HISGZ (ORCPT ); Thu, 9 Aug 2012 14:06:25 -0400 X-IronPort-AV: E=Sophos;i="4.77,741,1336374000"; d="scan'208";a="675087624" Received: from smtp2.corp.netapp.com ([10.57.159.114]) by mx2-out.netapp.com with ESMTP; 09 Aug 2012 11:05:55 -0700 Received: from davros.hq.netapp.com (davros.hq.netapp.com [10.63.225.83]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q79I5q55028755; Thu, 9 Aug 2012 11:05:55 -0700 (PDT) From: bjschuma@netapp.com To: Trond.Myklebust@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH 3/3] NFS: Use kzalloc() instead of kmalloc() in the idmapper Date: Thu, 9 Aug 2012 14:05:51 -0400 Message-Id: <1344535551-4412-3-git-send-email-bjschuma@netapp.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1344535551-4412-1-git-send-email-bjschuma@netapp.com> References: <1344535551-4412-1-git-send-email-bjschuma@netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Bryan Schumaker This will allocate memory that has already been zeroed, allowing us to remove the memset later on. Signed-off-by: Bryan Schumaker Tested-by: William Dauchy --- fs/nfs/idmap.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index 9864b48..4af524e 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c @@ -626,9 +626,6 @@ static int nfs_idmap_prepare_message(char *desc, struct idmap *idmap, substring_t substr; int token, ret; - memset(im, 0, sizeof(*im)); - memset(msg, 0, sizeof(*msg)); - im->im_type = IDMAP_TYPE_GROUP; im->im_private = idmap; token = match_token(desc, nfs_idmap_tokens, &substr); @@ -671,11 +668,11 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons, int ret = -ENOMEM; /* msg and im are freed in idmap_pipe_destroy_msg */ - msg = kmalloc(sizeof(*msg), GFP_KERNEL); + msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (!msg) goto out0; - im = kmalloc(sizeof(*im), GFP_KERNEL); + im = kzalloc(sizeof(*im), GFP_KERNEL); if (!im) goto out1;