From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Kiryanov Date: Mon, 20 Aug 2012 09:12:31 +0300 Subject: [U-Boot] [PATCH] common/lcd: add protection from null bmp pointer In-Reply-To: <502F7805.80301@myspectrum.nl> References: <1345113809-7871-1-git-send-email-nikita@compulab.co.il> <502E89D1.1070205@myspectrum.nl> <502F7805.80301@myspectrum.nl> Message-ID: <5031D54F.8040006@compulab.co.il> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08/18/2012 02:09 PM, Jeroen Hofstee wrote: > Hi, >> On 08/16/2012 12:43 PM, Nikita Kiryanov wrote: >>> If the bmp pointer is null (for example because the environment >>> variable "splashimage" was not defined) then U-Boot will get stuck >>> when trying to load the image. >> Which branch is this? At [1] there is a check for this.. >> >> 1600 s = getenv("splashimage"); >> 1601 if (s != NULL) { >> ... >> >> Regards, >> Jeroen >> >> [1] .... drivers/video/cfb_console.c..... > Just ignore above, since there are apparently more BMP drawing routines, > and I mentioned the wrong one. The same check is in lcd.c though: > > 822: if (do_splash && (s = getenv("splashimage")) != NULL) { > You are right; the null splashimage scenario was apparently a bad choice of example. However, lcd_display_bitmap is not a static function, and it appears in lcd.h. This means that someone might use it outside of common/lcd.c context, and for that reason it should be made more fault tolerant. I'll resubmit the patch without the splashimage example in the commit message. > Regards, > Jeroen >