Skip to contentSkip to conversation

common/lcd: add protection from null bmp pointer

PATCH New Nikita Kiryanov 2 participants 2 messages Aug 20, 2012 – Sep 21, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 common/lcd: add protection from null bmp pointer

If the bmp pointer is null 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.

---
This patch depends on the following patch:

	patchwork.ozlabs.org/patch/176058/
Changes in V2:
	- Previous commit message gave an incorrect example of when bmp pointer
	could be null, and was therefore removed.
 common/lcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/lcd.c +1 -1
index 88dfa51..fcc09ac 100644
@@ -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);
 
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v2 1/1 common/lcd: add protection from null bmp pointer

Hi,

Quoted 9 lines · On Mon, 20 Aug 2012 08:32:30 +0300 Nikita Kiryanov <[email protected]>…

If the bmp pointer is null 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.

Quoted 8 lines

---
This patch depends on the following patch:

	patchwork.ozlabs.org/patch/176058/
Changes in V2:
	- Previous commit message gave an incorrect example of when bmp pointer
	could be null, and was therefore removed.
 common/lcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied to video/master. I'm sorry for long delay.

Thanks,
Anatolij