public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2] common/lcd: add protection from null bmp pointer
@ 2012-08-20  5:32 Nikita Kiryanov
  2012-09-21 21:47 ` Anatolij Gustschin
  0 siblings, 1 reply; 2+ messages in thread
From: Nikita Kiryanov @ 2012-08-20  5:32 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
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(-)

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH V2] common/lcd: add protection from null bmp pointer
  2012-08-20  5:32 [U-Boot] [PATCH V2] common/lcd: add protection from null bmp pointer Nikita Kiryanov
@ 2012-09-21 21:47 ` Anatolij Gustschin
  0 siblings, 0 replies; 2+ messages in thread
From: Anatolij Gustschin @ 2012-09-21 21:47 UTC (permalink / raw)
  To: u-boot

Hi,

On Mon, 20 Aug 2012 08:32:30 +0300
Nikita Kiryanov <nikita@compulab.co.il> wrote:

> 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.
> 
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> ---
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-21 21:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20  5:32 [U-Boot] [PATCH V2] common/lcd: add protection from null bmp pointer Nikita Kiryanov
2012-09-21 21:47 ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox