From: Nikita Kiryanov <nikita@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] lcd: align bmp header when uncopmressing image
Date: Sun, 02 Jun 2013 14:05:44 +0300 [thread overview]
Message-ID: <51AB2708.9080207@compulab.co.il> (raw)
In-Reply-To: <1369999573-15449-1-git-send-email-p.wilczek@samsung.com>
Hello Piotr,
On 05/31/2013 02:26 PM, Piotr Wilczek wrote:
> -bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp)
> +bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp,
> + void **alloc_addr)
> {
> void *dst;
> unsigned long len;
> @@ -60,7 +65,14 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp)
> puts("Error: malloc in gunzip failed!\n");
> return NULL;
> }
> - if (gunzip(dst, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, &len) != 0) {
> +
> + bmp = dst;
> +
> + /* align to 32-bit-aligned-address + 2 */
> + if ((unsigned int)bmp % 0x04 != 0x02)
> + bmp = (bmp_image_t *)(((unsigned int)dst + 0x02) & ~0x01);
This is wrong. Suppose that bmp % 4 == 3, then (dst + 2) % 4 == 1,
and thus ((dst + 2) & ~1) % 4 == 0, which is not an aligned+2 address.
> +
> + if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, &len) != 0) {
> free(dst);
> return NULL;
> }
> @@ -68,8 +80,6 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp)
> puts("Image could be truncated"
> " (increase CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)!\n");
>
--
Regards,
Nikita.
next prev parent reply other threads:[~2013-06-02 11:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-24 7:46 [U-Boot] [PATCH] drivers:lcd: fix unaligned access on lcd Piotr Wilczek
2013-05-24 18:33 ` Wolfgang Denk
2013-05-27 11:35 ` Piotr Wilczek
2013-05-28 6:10 ` Nikita Kiryanov
2013-05-24 18:41 ` Jeroen Hofstee
2013-05-31 11:26 ` [U-Boot] [PATCH] lcd: align bmp header when uncopmressing image Piotr Wilczek
2013-05-31 14:22 ` Wolfgang Denk
2013-06-03 6:17 ` Piotr Wilczek
2013-06-03 11:15 ` Wolfgang Denk
2013-06-03 14:14 ` Piotr Wilczek
2013-06-03 18:45 ` Wolfgang Denk
2013-06-02 11:05 ` Nikita Kiryanov [this message]
2013-06-03 6:39 ` Piotr Wilczek
2013-06-03 11:18 ` Wolfgang Denk
2013-06-03 13:59 ` [U-Boot] [PATCH V2] " Piotr Wilczek
2013-06-03 18:44 ` Wolfgang Denk
2013-06-04 11:00 ` [U-Boot] [PATCH V3] " Piotr Wilczek
2013-06-04 15:05 ` Wolfgang Denk
2013-06-05 6:14 ` [U-Boot] [PATCH V4] " Piotr Wilczek
2013-07-01 18:51 ` Anatolij Gustschin
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=51AB2708.9080207@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.