
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 nikita@compulab.co.il Signed-off-by: Igor Grinberg grinberg@compulab.co.il Cc: Anatolij Gustschin agust@denx.de Cc: Wolfgang Denk wd@denx.de Cc: Albert ARIBAUD albert.u.boot@aribaud.net Cc: Jeroen Hofstee jeroen@myspectrum.nl --- 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;