From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23355 invoked by alias); 11 Dec 2007 14:28:05 -0000 Received: (qmail 23347 invoked by uid 22791); 11 Dec 2007 14:28:04 -0000 X-Spam-Check-By: sourceware.org Received: from 204-133-123-27.dia.static.slbbi.com (HELO mail.chez-thomas.org) (204.133.123.27) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Dec 2007 14:28:00 +0000 Received: by mail.chez-thomas.org (Postfix, from userid 999) id 19DEF1950270; Tue, 11 Dec 2007 07:27:58 -0700 (MST) Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by mail.chez-thomas.org (Postfix) with ESMTP id 7D4AF195026F; Tue, 11 Dec 2007 07:27:56 -0700 (MST) Message-ID: <475E9DCB.3080902@mlbassoc.com> Date: Tue, 11 Dec 2007 14:28:00 -0000 From: Gary Thomas User-Agent: Thunderbird 2.0.0.5 (X11/20070727) MIME-Version: 1.0 To: =?ISO-8859-1?Q?=D8yvind_Harboe?= CC: Andrew Lunn , eCos Disuss References: <20071211094252.GD30586@lunn.ch> <20071211100356.GF30586@lunn.ch> <20071211135137.GG30586@lunn.ch> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Re: Check for illegal address range in io/flash X-SW-Source: 2007-12/txt/msg00033.txt.bz2 Øyvind Harboe wrote: > On Dec 11, 2007 2:51 PM, Andrew Lunn wrote: >> On Tue, Dec 11, 2007 at 11:09:40AM +0100, ?yvind Harboe wrote: >>> On Dec 11, 2007 11:03 AM, Andrew Lunn wrote: >>>>> I mainly want the busted check in flash_erase() to be removed. >>>>> ASSERT's are probably fine. >> What is actually wrong with this check? > > I have no idea what this check is supposed to do. > > If a valid range is passed in, it is a no-operation, otherwise it does > something mysterious > that looks just wrong to me. > > I'm afraid all I can conclude is that it should be deleted as plain > wrong/unused. The > fact that it is harmless for valid ranges has allowed it to survive to date, > that's the antrophic principle for you I guess. > > Someone else would have to speak up for it. > > It would be a shame if plain wrong harmless code that nobody understands > could never be deleted from eCos :-) > >> I don't want to remove this until i fully understand what is causing >> your problem and how this code is wrong. Please could you explain what >> you are seeing. > > The problem is that I relied on flash_erase() to return an error upon illegal > address range. When I tested with an illegal address range, > flash_erase() did not > return an error. Upon inspecting the code, I saw something that looked > like it is *trying* to check the address, but I have found no explanation > for that code, so I see a couple of alternatives: > > - if nobody understands this code, delete it after a week or two to > wait for someone to > speak up and see what happens. Probably nothing. > - keep this code forever as it is harmless(with valid addresses) > nobody will be hurt by it. > - add address check to flash_erase() & program and return error message As I read the code, the "check" you are talking about is only to make sure that the address [range] which gets printed makes sense. There is similar code within the loop to handle the edge case where the FLASH region being erased buts up against the top of possible address space. I don't see any error checking present at all. -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss