public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nikita Kiryanov <nikita@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 3/7] lcd: prevent unaligned memory access when displaying splash screen
Date: Tue, 29 Jan 2013 16:34:50 +0200	[thread overview]
Message-ID: <5107DE0A.9060309@compulab.co.il> (raw)
In-Reply-To: <20130129134602.C61712A08AC@gemini.denx.de>

Hi Wolfgang Denk,

On 01/29/2013 03:46 PM, Wolfgang Denk wrote:
> Dear Nikita Kiryanov,
>
> In message <1359463349-11649-4-git-send-email-nikita@compulab.co.il> you wrote:
>> When the bmp file is loaded to an address specified by the environment
>> variable "splashimage", its header members might be unaligned.
>> This happens because the bmp header starts with two byte-size fields followd by
>> mostly 32 bit fields, so when the address in splashimage is not equal to aligned
>> address plus/minus 2, the 32 bit members will be placed in unaligned addresses.
>> This results in a data abort on targets that cannot handle unaligned memory
>> accesses.
>
> I don;t understand your +/- 2 argument.  When there are 32 bit fielkds
> in the header, these have to be 32 bit aligned, right?

Right. The problem stems from the structure of the bmp header, which
places the 32 bit fields at an offset of 2 from the load address.

 From bmp_layout.h:
typedef struct bmp_header {
	/* Header */
	char signature[2];   <--- This is what's causing the offset
	__u32	file_size;
	__u32	reserved;
	__u32	data_offset;
...
}

This means that in order for these 32 bit fields to be properly aligned
when you load the bmp into memory, it has to be placed with a +/- offset
relative to an aligned address to cancel the shift that
char signature[2] causes.

>
>> Check that the address is safe to use, and fix it if it's not.
>
> If you perform any such fixes (thus essentially not doing what the
> user asked for), you should at least print a warning message so the
> user gets aware of such issues.
>
> Also, you should add the video custodian on Cc: for such patches.
>
> [Done here].

Thanks, I'll do that in the future.

>
>
> Best regards,
>
> Wolfgang Denk
>


-- 
Regards,
Nikita.

  reply	other threads:[~2013-01-29 14:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 12:42 [U-Boot] [PATCH V2 0/7] Add splash screen for CM-T35 Nikita Kiryanov
2013-01-29 12:42 ` [U-Boot] [PATCH V1 1/7] omap3: add useful dss defines Nikita Kiryanov
2013-01-29 13:55   ` Wolfgang Denk
2013-01-29 14:11     ` Nikita Kiryanov
2013-01-29 12:42 ` [U-Boot] [PATCH V2 2/7] omap3: allow dynamic selection of gfx_format Nikita Kiryanov
2013-01-29 13:52   ` Wolfgang Denk
2013-01-29 14:22     ` Nikita Kiryanov
2013-01-29 12:42 ` [U-Boot] [PATCH V2 3/7] lcd: prevent unaligned memory access when displaying splash screen Nikita Kiryanov
2013-01-29 13:46   ` Wolfgang Denk
2013-01-29 14:34     ` Nikita Kiryanov [this message]
2013-01-29 12:42 ` [U-Boot] [PATCH V1 4/7] lcd: add option for board specific splash screen preparation Nikita Kiryanov
2013-01-29 13:46   ` Wolfgang Denk
2013-01-29 14:44     ` Nikita Kiryanov
2013-01-29 12:42 ` [U-Boot] [PATCH V2 5/7] cm-t35: add support for dvi displays Nikita Kiryanov
2013-01-29 14:00   ` Wolfgang Denk
2013-01-29 15:04     ` Nikita Kiryanov
2013-01-29 12:42 ` [U-Boot] [PATCH V2 6/7] cm-t35: add support for user defined lcd parameters Nikita Kiryanov
2013-01-29 13:48   ` Wolfgang Denk
2013-01-30  8:00     ` Nikita Kiryanov
2013-01-29 12:42 ` [U-Boot] [PATCH V2 7/7] cm-t35: add support for loading splash image from NAND Nikita Kiryanov
2013-01-29 13:50   ` Wolfgang Denk
2013-01-30  8:08     ` Nikita Kiryanov
  -- strict thread matches above, loose matches on Subject: below --
2013-01-31  7:39 [U-Boot] [PATCH V3 0/7] Add splash screen for CM-T35 Nikita Kiryanov
2013-01-31  7:39 ` [U-Boot] [PATCH V2 3/7] lcd: prevent unaligned memory access when displaying splash screen Nikita Kiryanov
2013-02-10 11:14   ` Nikita Kiryanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5107DE0A.9060309@compulab.co.il \
    --to=nikita@compulab.co.il \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox