public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mkimage: SEGFAULT with imximage on 64 bit systems
Date: Fri, 29 Jan 2010 17:57:28 +0100	[thread overview]
Message-ID: <4B631378.8070804@denx.de> (raw)
In-Reply-To: <201001291104.59853.vapier@gentoo.org>

Mike Frysinger wrote:
> man this is terrible terrible code.  using 64bit casts may fix 64bit systems, 
> but doesnt seem right on 32bit systems as you'd introduce more pointer/size 
> mismatches.

You are right - it works on 32 bit systems for the only reason that I
compute a fix offset inside a structure, as you pointed out later.

> if the only thing you want is imx_hdr->ext_header, why not do it that way:
> 	ext_header = &imx_hdr->ext_header

I can't, this is wrong. The ext_header is not fixed, but depends on the
size of the DCD table, that is variable. This table is set via a
configuration file and is specific for each board.
The ext_header pointer must be set at the next 32bit location after this
table.

> then again, this looks like you're doing constant subtraction.  the distance 
> between two struct members is always going to be the same, so why dont you use 
> offsetof() to avoid the random pointer ugliness.

Sometimes I miss the easiest solution. Thanks to point this out !

Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  reply	other threads:[~2010-01-29 16:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-29 10:22 [U-Boot] [PATCH] mkimage: SEGFAULT with imximage on 64 bit systems Stefano Babic
2010-01-29 16:04 ` Mike Frysinger
2010-01-29 16:57   ` Stefano Babic [this message]
2010-02-05 14:16 ` [U-Boot] [PATCH V2] " Stefano Babic
2010-02-23  1:34   ` Kim Phillips
2010-02-23 23:07   ` Wolfgang Denk

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=4B631378.8070804@denx.de \
    --to=sbabic@denx.de \
    --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