From mboxrd@z Thu Jan 1 00:00:00 1970 From: York Sun Date: Fri, 7 Jan 2011 08:49:17 -0800 Subject: [U-Boot] [PATCH v2 2/9] make the hwconfig buffer deeper In-Reply-To: <740DF509-6661-4611-BE1B-BBB629012697@kernel.crashing.org> References: <1292630381-23022-1-git-send-email-yorksun@freescale.com> <1292630381-23022-2-git-send-email-yorksun@freescale.com> <20101218222535.58FF31524E8@gemini.denx.de> <1294085287.24386.52.camel@oslab-l1> <20110103211125.710E5CEF7A6@gemini.denx.de> <1294089991.24386.58.camel@oslab-l1> <20110103214745.CCE33CEF94F@gemini.denx.de> <740DF509-6661-4611-BE1B-BBB629012697@kernel.crashing.org> Message-ID: <1294418957.8466.8.camel@oslab-l1> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 2011-01-07 at 09:14 -0600, Kumar Gala wrote: > On Jan 3, 2011, at 3:47 PM, Wolfgang Denk wrote: > > > Dear York Sun, > > > > In message <1294089991.24386.58.camel@oslab-l1> you wrote: > >> > >>> Hm... I have no idea whish sort of "buggy code" you are referring to > >>> here, but in this case we shoul start and fix that buggy code, right? > >> > >> Making a buffer in a function's stack and make use of it out of the > >> scope, that's the buggy code I am referring. > > > > That is bad indeed, and needs to be fixed. > > Where is that happening? > > >>> You fail to explain why we should change anything when you "don't need > >>> more than 128 characters for hwconfig" in the first place? > >> > >> I don't need more than 128 characters. However, the stack is trashed by > >> other functions. I have to push the stack deeper to keep the content > >> unchanged. I am not happy with it. > > > > Now I understand what you mean. > > > > But we do not need a bigger buffer, or store another copy of the whole > > content of the "hwconfig" variable - we just need room to for the > > return value of hwconfig_parse(), which usually should be (much) > > smaller than the content of the "hwconfig" variable. > > I agree with WD, I'm confused. Can you provide the hwconfig string you are using that has issues with 128 but works at 256. > > - k fsl_ddr:ctlr_intlv=cacheline,bank_intlv=cs0_cs1_cs2_cs3,ecc=off,addr_hash=false With the buffer size 128, the sub function gets "ctlr_intlv=cacheline,bank_intlv=cs0_". It is not because the buffer is not enough, but the stack has been trashed. I have debug log if you need it. York