[U-Boot] [PATCH] common/lcd: add protection from null bmp pointer
Nikita Kiryanov
nikita at compulab.co.il
Thu Aug 16 12:43:29 CEST 2012
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.
What's worse, it will get stuck before the U-Boot shell becomes
available to the user, thus making it difficult to correct the
situation.
To protect from the above scenario, check if the pointer is valid.
Signed-off-by: Nikita Kiryanov <nikita at compulab.co.il>
Acked-by: Igor Grinberg <grinberg at compulab.co.il>
---
This patch depends on the following patch:
patchwork.ozlabs.org/patch/176058/
common/lcd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/lcd.c b/common/lcd.c
index 88dfa51..fcc09ac 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -674,7 +674,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
unsigned long pwidth = panel_info.vl_col;
unsigned colors, bpix, bmp_bpix;
- if (!((bmp->header.signature[0] == 'B') &&
+ if (!bmp || !((bmp->header.signature[0] == 'B') &&
(bmp->header.signature[1] == 'M'))) {
printf("Error: no valid bmp image at %lx\n", bmp_image);
--
1.7.5.4
More information about the U-Boot
mailing list