From patchwork Thu Feb 19 20:24:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 8035 X-Patchwork-Delegate: agk@redhat.com Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1JKPZ1O025459 for ; Thu, 19 Feb 2009 20:25:36 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id F3189618C91; Thu, 19 Feb 2009 15:25:34 -0500 (EST) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n1JKPUHO016066 for ; Thu, 19 Feb 2009 15:25:30 -0500 Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n1JKPPLl010856 for ; Thu, 19 Feb 2009 15:25:25 -0500 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id n1JKPFIa014797 for ; Thu, 19 Feb 2009 15:25:16 -0500 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id n1JKOpBR012116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 19 Feb 2009 12:24:52 -0800 Received: from localhost.localdomain (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id n1JKOont020690; Thu, 19 Feb 2009 12:24:50 -0800 Message-Id: <200902192024.n1JKOont020690@imap1.linux-foundation.org> To: mm-commits@vger.kernel.org From: akpm@linux-foundation.org Date: Thu, 19 Feb 2009 12:24:50 -0800 X-Spam-Status: No, hits=-2.943 required=5 tests=AWL,BAYES_00 X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32 X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 X-RedHat-Spam-Score: -1.596 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, penberg@cs.helsinki.fi, hannes@cmpxchg.org Subject: [dm-devel] + md-use-kzfree.patch added to -mm tree X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com The patch titled md: use kzfree() has been added to the -mm tree. Its filename is md-use-kzfree.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: md: use kzfree() From: Johannes Weiner Use kzfree() instead of memset() + kfree(). Signed-off-by: Johannes Weiner Reviewed-by: Pekka Enberg Cc: Alasdair Kergon Signed-off-by: Andrew Morton --- drivers/md/dm-crypt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff -puN drivers/md/dm-crypt.c~md-use-kzfree drivers/md/dm-crypt.c --- a/drivers/md/dm-crypt.c~md-use-kzfree +++ a/drivers/md/dm-crypt.c @@ -1137,8 +1137,7 @@ bad_ivmode: crypto_free_ablkcipher(tfm); bad_cipher: /* Must zero key material before freeing */ - memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8)); - kfree(cc); + kzfree(cc); return -EINVAL; } @@ -1164,8 +1163,7 @@ static void crypt_dtr(struct dm_target * dm_put_device(ti, cc->dev); /* Must zero key material before freeing */ - memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8)); - kfree(cc); + kzfree(cc); } static int crypt_map(struct dm_target *ti, struct bio *bio,