From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Gunthorpe Subject: Re: [PATCH v4 2/8] tpm: replace dynamically allocated bios_dir with dentry array Date: Fri, 30 Sep 2016 12:30:26 -0600 Message-ID: <20160930183026.GC1867@obsidianresearch.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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20160930182703.GA9595-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Jarkko Sakkinen Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: tpmdd-devel@lists.sourceforge.net 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. Jason ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot