提交 021414a3 编写于 作者: X xypron.glpk@gmx.de 提交者: Anatolij Gustschin

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: NHeinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: NSimon Glass <sjg@chromium.org>
Reviewed-by: NPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
上级 56192959
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册