linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Milton Miller <miltonm@bga.com>
Cc: linuxppc-dev@ozlabs.org, Simon Horman <horms@verge.net.au>,
	kexec@lists.infradead.org, "M.MohanK" <"umar mohan"@in.ibm.com>
Subject: Re: [PATCH kexec-tools 1/5] ppc64: always check number of ranges when adding
Date: Wed, 07 Jan 2009 13:42:52 +1100	[thread overview]
Message-ID: <1231296172.8292.20.camel@localhost> (raw)
In-Reply-To: <kexec-29-1-1r.miltonm@bga.com>

[-- Attachment #1: Type: text/plain, Size: 2668 bytes --]

On Fri, 2009-01-02 at 15:04 -0600, Milton Miller wrote:
> make the idom "always call realloc_memory_ranges when filling a range entry"
> 
> kexec was core dumping after using 5 exclude_range pairs when only 3
> were allocated.
> 
> also delcare realloc_memory_ranges to take no arguments.
> 
> Signed-off-by: Milton Miller <miltonm@bga.com>
> 
> Index: kexec-tools/kexec/arch/ppc64/kexec-ppc64.c
> ===================================================================
> --- kexec-tools.orig/kexec/arch/ppc64/kexec-ppc64.c	2009-01-02 02:08:58.000000000 -0600
> +++ kexec-tools/kexec/arch/ppc64/kexec-ppc64.c	2009-01-02 02:09:08.000000000 -0600
> @@ -96,7 +96,7 @@ err1:
>  
>  }
>  
> -static int realloc_memory_ranges()
> +static int realloc_memory_ranges(void)
>  {
>  	size_t memory_range_len;
>  
> @@ -469,6 +469,8 @@ static int get_devtree_details(unsigned 
>  				exclude_range[i].start = initrd_start;
>  				exclude_range[i].end = initrd_end;
>  				i++;
> +				if (i >= max_memory_ranges)
> +					realloc_memory_ranges();
>  			}
>  		} /* chosen */
>  
> @@ -581,6 +583,8 @@ static int get_devtree_details(unsigned 
>  			exclude_range[i].start = tce_base;
>  			exclude_range[i].end = tce_base + tce_size;
>  			i++;
> +			if (i >= max_memory_ranges)
> +				realloc_memory_ranges();
>  			if (kexec_flags & KEXEC_ON_CRASH)
>  				add_usable_mem_rgns(tce_base, tce_size);
>  			closedir(cdir);
> @@ -634,6 +638,8 @@ int setup_memory_ranges(unsigned long ke
>  				memory_range[j].end = exclude_range[i].start - 1;
>  				memory_range[j].type = RANGE_RAM;
>  				j++;
> +				if (j >= max_memory_ranges)
> +					realloc_memory_ranges();
>  			}
>  		} /* i == 0 */
>  		/* If the last exclude range does not end at memory_max, include
> @@ -646,6 +652,8 @@ int setup_memory_ranges(unsigned long ke
>  				memory_range[j].end = memory_max;
>  				memory_range[j].type = RANGE_RAM;
>  				j++;
> +				if (j >= max_memory_ranges)
> +					realloc_memory_ranges();
>  				/* Limit the end to rmo_top */
>  				if (memory_range[j-1].start >= rmo_top) {
>  					j--;
> @@ -666,6 +674,8 @@ int setup_memory_ranges(unsigned long ke
>  		memory_range[j].end = exclude_range[i+1].start - 1;
>  		memory_range[j].type = RANGE_RAM;
>  		j++;
> +		if (i >= max_memory_ranges)
> +			realloc_memory_ranges();

Should this be checking against i or j?

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2009-01-07  2:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-02 20:42 [PATCH 0/5 + 2] kexec updates Milton Miller
2009-01-02 20:44 ` Milton Miller
2009-01-02 20:44 ` Milton Miller
2009-01-02 20:44 ` Milton Miller
2009-01-02 20:44 ` Milton Miller
2009-01-02 20:46 ` [PATCH] powerpc: make dummy section a valid note header Milton Miller
2009-01-02 20:46 ` [PATCH] powerpc: check crash_base for relocatable kernel Milton Miller
2009-01-06 23:44   ` Michael Ellerman
2009-01-07 14:57     ` Milton Miller
2009-01-08  3:35       ` Michael Ellerman
2009-01-02 21:04 ` [PATCH kexec-tools 1/5] ppc64: always check number of ranges when adding Milton Miller
2009-01-07  2:42   ` Michael Ellerman [this message]
2009-01-07 14:34     ` Milton Miller
2009-01-08 12:33     ` [PATCH kexec-tools v2] ppc64: always check number of ranges when adding them Milton Miller
2009-01-02 21:04 ` [PATCH kexec-tools 2/5] ppc64: update kdump for 2.6.28 relocatable kernel Milton Miller
2009-01-02 21:04 ` [PATCH kexec-tools 4/5] ppc64: cleanups Milton Miller
2009-01-02 21:04 ` [PATCH kexec-tools 5/5] entry wants to be void * Milton Miller
2009-01-12  6:24 ` [PATCH 0/5 + 2] kexec updates Simon Horman
2009-01-13  4:15   ` M. Mohan Kumar
2009-01-13 15:59   ` Milton Miller
2009-01-15 22:43     ` Simon Horman

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=1231296172.8292.20.camel@localhost \
    --to=michael@ellerman.id.au \
    --cc="umar mohan"@in.ibm.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=miltonm@bga.com \
    /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;
as well as URLs for NNTP newsgroup(s).