From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933193Ab0EDPPL (ORCPT ); Tue, 4 May 2010 11:15:11 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:47195 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932078Ab0EDPPI (ORCPT ); Tue, 4 May 2010 11:15:08 -0400 Date: Tue, 4 May 2010 10:14:43 -0500 From: "Serge E. Hallyn" To: David Howells Cc: lkml , Ashwin Ganti , Greg KH , rsc@swtch.com, ericvh@gmail.com, linux-security-module@vger.kernel.org, Ron Minnich , jt.beard@gmail.com, Andrew Morgan , Andrew Morton , Oleg Nesterov , Eric Paris , "Eric W. Biederman" , Randy Dunlap , Michael Kerrisk , Alan Cox , Kyle Moffett , Steve Grubb Subject: Re: [PATCH 3/3] RFC: p9auth: add p9auth fs Message-ID: <20100504151443.GA18700@us.ibm.com> References: <20100427164517.GC7530@us.ibm.com> <20100427164139.GA7359@us.ibm.com> <4067.1272985037@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4067.1272985037@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting David Howells (dhowells@redhat.com): > Serge E. Hallyn wrote: > > > + result = kzalloc(MAX_DIGEST_SIZE, GFP_KERNEL); > > ... > > + ret = crypto_hash_digest(&desc, &sg, plain_text_size, result); > > Does result have to be pre-cleared? > > > + user_buf = kzalloc(count+1, GFP_KERNEL); > > + if (!user_buf) > > + goto out; > > + > > + if (copy_from_user(user_buf, buffer, count)) { > > user_buf doesn't need preclearing. It's just a waste of time. This occurs > three times. Hm, yeah, the first doesn't need it at all, and the latter two should just kmalloc and set user_buf[count] = '\0'. thanks, -serge