aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxypron.glpk@gmx.de <xypron.glpk@gmx.de>2017-07-30 21:59:23 +0200
committerAnatolij Gustschin <agust@denx.de>2017-08-19 20:42:20 +0200
commit021414a33248f9c1f6eb4a676f4a1fbcfa26f475 (patch)
tree8b6fb31e582583158da079aa164a9472de57b7a6
parent5619295995e3262bb5770e8b5e945ffdc5442145 (diff)
downloadu-boot-021414a33248f9c1f6eb4a676f4a1fbcfa26f475.zip
u-boot-021414a33248f9c1f6eb4a676f4a1fbcfa26f475.tar.gz
u-boot-021414a33248f9c1f6eb4a676f4a1fbcfa26f475.tar.bz2
lcd: avoid possible NULL dereference
Do not dereference bmp before the check if it is NULL. The problem was indicated by cppcheck. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
-rw-r--r--common/lcd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/lcd.c b/common/lcd.c
index c3ff959..4b3d7dc 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -578,7 +578,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
unsigned long pwidth = panel_info.vl_col;
unsigned colors, bpix, bmp_bpix;
int hdr_size;
- struct bmp_color_table_entry *palette = bmp->color_table;
+ struct bmp_color_table_entry *palette;
if (!bmp || !(bmp->header.signature[0] == 'B' &&
bmp->header.signature[1] == 'M')) {
@@ -587,6 +587,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
return 1;
}
+ palette = bmp->color_table;
width = get_unaligned_le32(&bmp->header.width);
height = get_unaligned_le32(&bmp->header.height);
bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);