Skip to content
Snippets Groups Projects
Commit 021414a3 authored by xypron.glpk@gmx.de's avatar xypron.glpk@gmx.de Committed by Anatolij Gustschin
Browse files

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: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
parent 56192959
No related branches found
No related tags found
No related merge requests found
...@@ -578,7 +578,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) ...@@ -578,7 +578,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
unsigned long pwidth = panel_info.vl_col; unsigned long pwidth = panel_info.vl_col;
unsigned colors, bpix, bmp_bpix; unsigned colors, bpix, bmp_bpix;
int hdr_size; 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' && if (!bmp || !(bmp->header.signature[0] == 'B' &&
bmp->header.signature[1] == 'M')) { bmp->header.signature[1] == 'M')) {
...@@ -587,6 +587,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) ...@@ -587,6 +587,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
return 1; return 1;
} }
palette = bmp->color_table;
width = get_unaligned_le32(&bmp->header.width); width = get_unaligned_le32(&bmp->header.width);
height = get_unaligned_le32(&bmp->header.height); height = get_unaligned_le32(&bmp->header.height);
bmp_bpix = get_unaligned_le16(&bmp->header.bit_count); bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment