If the BMP headers are located in unaligned addresses, accessing them directly may lead to a data abort on some architectures. Use the safer bmp_layout API instead.
Signed-off-by: Nikita Kiryanov <[email protected]> Signed-off-by: Igor Grinberg <[email protected]> Cc: Anatolij Gustschin <[email protected]> Cc: Wolfgang Denk <[email protected]> Cc: Albert ARIBAUD <[email protected]> Cc: Jeroen Hofstee <[email protected]> --- drivers/video/bus_vcxk.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/video/bus_vcxk.c b/drivers/video/bus_vcxk.c index a0607cf..d382ac1 100644 --- a/drivers/video/bus_vcxk.c +++ b/drivers/video/bus_vcxk.c @@ -401,14 +401,12 @@ int vcxk_display_bitmap(ulong addr, int x, int y) unsigned char *dataptr; bmp = (bmp_image_t *) addr; - if ((bmp->header.signature[0] == 'B') && - (bmp->header.signature[1] == 'M')) { - width = le32_to_cpu(bmp->header.width); - height = le32_to_cpu(bmp->header.height); - bpp = le16_to_cpu(bmp->header.bit_count); - - dataptr = (unsigned char *) bmp + - le32_to_cpu(bmp->header.data_offset); + if (bmp_signature_valid(bmp)) { + width = bmp_get_width(bmp); + height = bmp_get_height(bmp); + bpp = bmp_get_bit_count(bmp); + + dataptr = (unsigned char *) bmp + bmp_get_data_offset(bmp); if (display_width < (width + x)) c_width = display_width - x; -- 1.7.10.4 _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

