public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] malloc_simple: fix malloc_ptr calculation
Date: Sun, 13 Sep 2015 12:24:20 +0200	[thread overview]
Message-ID: <55F54ED4.2020406@redhat.com> (raw)
In-Reply-To: <1441708884-26165-1-git-send-email-ilu@linutronix.de>

Hi,

On 08-09-15 12:41, Philipp Rosenberger wrote:
> The gd->malloc_ptr and the gd->malloc_limit are offsets to gd->malloc_base.
> But the addr variable contains the absolute address. The new_ptr must be:
> addr + bytes - gd->malloc_base.
>
> Signed-off-by: Philipp Rosenberger <ilu@linutronix.de>

You're right, good catch:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>   common/malloc_simple.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/malloc_simple.c b/common/malloc_simple.c
> index 134e059..c745863 100644
> --- a/common/malloc_simple.c
> +++ b/common/malloc_simple.c
> @@ -32,7 +32,7 @@ void *memalign_simple(size_t align, size_t bytes)
>   	void *ptr;
>
>   	addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
> -	new_ptr = addr + bytes;
> +	new_ptr = addr + bytes - gd->malloc_base;
>   	if (new_ptr > gd->malloc_limit)
>   		return NULL;
>   	ptr = map_sysmem(addr, bytes);
>

  reply	other threads:[~2015-09-13 10:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08 10:41 [U-Boot] [PATCH] malloc_simple: fix malloc_ptr calculation Philipp Rosenberger
2015-09-13 10:24 ` Hans de Goede [this message]
2015-09-28 21:07 ` [U-Boot] " Tom Rini
2015-09-30 13:57   ` Sjoerd Simons

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=55F54ED4.2020406@redhat.com \
    --to=hdegoede@redhat.com \
    --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