[U-Boot] [PATCH 0/5] Create an API for safely accessing BMP header fields

Nikita Kiryanov nikita at compulab.co.il
Mon Feb 4 12:39:34 CET 2013


When configuring U-Boot to display a splash image, the user is free to
designate whatever address they see fit as the in-memory location of BMP
file. Unfortunately, this makes it easy to place the BMP header fields in
unaligned addresses, which will cause a data abort on architectures which
can't handle unaligned memory accesses. What's worse, addresses which are
supposed to be issue free (32 bit aligned addresses) actually don't work
because of the structure of the BMP header file (the header starts with 2
chars, followed by __u32 fields. The two chars offset the 32 bit fields away
from proper alignment).

As a result, it is very easy to brick the board that U-Boot runs on with certain
architectures. Once a bad address for splash image is selected and the board
restarted, U-Boot never reaches command line, and yet the only way to prevent
the data aborts from happening is to clear or change the environment variable
splashimage.

While it is possible to fix the problem by compiling all relevant files with
$(PLATFORM_NO_UNALIGNED), it is possible to handle it with finer granularity by
creating an API for header accesses, and compiling only that with
$(PLATFORM_NO_UNALIGNED).

This patchset creates such an API, and makes use of it wherever an in-memory BMP
header is probed for data.

Further information can be found in this discussion:
http://lists.denx.de/pipermail/u-boot/2013-January/144666.html

Nikita Kiryanov (5):
  Add bmp_layout module for accessing BMP header data
  lcd: use bmp_layout API
  cmd_bmp: use bmp_layout API
  video/cfb_console: use bmp_layout API
  video/bus_vcxk: use bmp_layout API

 common/Makefile             |    8 ++++
 common/bmp_layout.c         |   96 +++++++++++++++++++++++++++++++++++++++++++
 common/cmd_bmp.c            |   17 ++++----
 common/lcd.c                |   21 +++++-----
 drivers/video/bus_vcxk.c    |   14 +++----
 drivers/video/cfb_console.c |   22 +++++-----
 include/bmp_layout.h        |   15 +++++++
 7 files changed, 152 insertions(+), 41 deletions(-)
 create mode 100644 common/bmp_layout.c

-- 
1.7.10.4



More information about the U-Boot mailing list