From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: [PATCH v4 2/8] tpm: replace dynamically allocated bios_dir with dentry array Date: Sat, 1 Oct 2016 15:06:35 +0300 Message-ID: <20161001120635.GA16233@intel.com> References: <1475051682-23060-1-git-send-email-nayna@linux.vnet.ibm.com> <1475051682-23060-3-git-send-email-nayna@linux.vnet.ibm.com> <20160930182703.GA9595@intel.com> <20160930183026.GC1867@obsidianresearch.com> <20160930194825.GB12710@intel.com> <20160930203147.GB5722@obsidianresearch.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20160930203147.GB5722-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Jason Gunthorpe Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: tpmdd-devel@lists.sourceforge.net On Fri, Sep 30, 2016 at 02:31:47PM -0600, Jason Gunthorpe wrote: > On Fri, Sep 30, 2016 at 10:48:25PM +0300, Jarkko Sakkinen wrote: > > On Fri, Sep 30, 2016 at 12:30:26PM -0600, Jason Gunthorpe wrote: > > > On Fri, Sep 30, 2016 at 09:27:03PM +0300, Jarkko Sakkinen wrote: > > > > On Wed, Sep 28, 2016 at 04:34:36AM -0400, Nayna Jain wrote: > > > > > > > > - struct dentry **bios_dir; > > > > > + struct dentry *bios_dir[3]; > > > > > + unsigned int bios_dir_count; > > > > > > > > You should rather have a four entry array and use a NULL terminator. > > > > > > Why? Then everything has to compute the length before doing > > > anything. The basic ops are 'append to back' and 'pop off back' which > > > require length. > > > > One variable less to struct tpm_chip. The loop that removes the files > > simply can continue until NULL is encountered. > > We've been over this, the loop has to remove them in reverse over. > > Why are you so concerned about size of tpm_chip?? It's not the size. It's the added complexity. I'll look into revising this commit a bit in order in order to move things forward... /Jarkko ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot