From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Thu, 13 Oct 2016 09:50:07 -0400 Subject: [U-Boot] [PATCH 3/3] ti: common: board_detect: Return a valid empty string for un-initialized eeprom In-Reply-To: <20161011173905.26208-4-nm@ti.com> References: <20161011173905.26208-1-nm@ti.com> <20161011173905.26208-4-nm@ti.com> Message-ID: <20161013135007.GI4990@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Oct 11, 2016 at 12:39:05PM -0500, Nishanth Menon wrote: > Current logic for query of revision, board_name, config returns > NULL. Users of these functions do a direct strncmp to compare. > Unfortunately, as per conventions require two valid strings to compare > against and the current implementation causes a crash when compared > with NULL. > > We'd still like to maintain the simplistic usage of these APIs instead > of redundant if (string) res=strncmp(fn(),"cmp",n); flowing all over > the place. > > Hence, since the version, name and config is already pre-initialized > with empty string, just dont check for invalid header in the first > place and return the empty string to the caller. > > Reported-by: Brad Griffis > Signed-off-by: Nishanth Menon Reviewed-by: Tom Rini -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: