All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: paulus@samba.org
Cc: linuxppc-dev@ozlabs.org, akpm@linux-foundation.org,
	tglx@linutronix.de, mingo@elte.hu
Subject: Re: [patch 06/24] lmb: add lmb_alloc_nid()
Date: Mon, 31 Mar 2008 22:21:21 -0700 (PDT)	[thread overview]
Message-ID: <20080331.222121.264093711.davem@davemloft.net> (raw)
In-Reply-To: <18417.46834.753849.815163@cargo.ozlabs.ibm.com>

From: Paul Mackerras <paulus@samba.org>
Date: Tue, 1 Apr 2008 15:15:46 +1100

> akpm@linux-foundation.org writes:
> 
> > From: David Miller <davem@davemloft.net>
> > 
> > A variant of lmb_alloc() that tries to allocate memory on a specified NUMA
> > node 'nid' but falls back to normal lmb_alloc() if that fails.
> 
> ...
> 
> > +static u64 __init lmb_alloc_nid_unreserved(u64 start, u64 end,
> > +					   u64 size, u64 align)
> > +{
> > +	u64 base;
> > +	long j;
> > +
> > +	base = lmb_align_down((end - size), align);
> > +	while (start <= base &&
> > +	       ((j = lmb_overlaps_region(&lmb.reserved, base, size)) >= 0))
> > +		base = lmb_align_down(lmb.reserved.region[j].base - size,
> > +				      align);
> 
> How do we know that lmb.reserved.region[j].base is >= size at this
> point?  If it isn't, then base could end up as some extremely large
> unsigned value, which would be a Bad Thing.

The same exact issue exists in the existing code, from which this is
derived, in __lmb_alloc_base().

This situation can occur any time a region is smaller than the 'size'
argument, in both functions.

      reply	other threads:[~2008-04-01  5:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-28 21:21 [patch 06/24] lmb: add lmb_alloc_nid() akpm
2008-04-01  4:15 ` Paul Mackerras
2008-04-01  5:21   ` David Miller [this message]

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=20080331.222121.264093711.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=akpm@linux-foundation.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.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.