mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: Paul Mundt <lethal@linux-sh.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	David Howells <dhowells@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	cooloney@kernel.org, mpm@selenic.com
Subject: Re: [PATCH] nommu: fix kobjsize() for SLOB and SLUB, v2.
Date: Tue, 10 Jun 2008 10:30:36 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0806101027220.17093@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20080602072706.GB28268@linux-sh.org>

On Mon, 2 Jun 2008, Paul Mundt wrote:

> +	page = virt_to_head_page(objp);
> +	if (!page)
> +		return 0;

virt_to_head_page cannot return NULL. virt_to_page also does not return 
NULL. pfn_valid() needs to be used to figure out if a page is valid. 
Otherwise the page struct reference that was returned may have 
PageReserved() set to indicate that it is not a valid page.

> +	 * The ksize() function is only guaranteed to work for pointers
> +	 * returned by kmalloc(). So handle arbitrary pointers, that we expect
> +	 * always to be compound pages, here.
> +	 */
> +	if (PageCompound(page))
> +		order = compound_order(page);

compund order returns 0 if you use compound_order() on a 
non compound page. No need for the PageCompound test.


  parent reply	other threads:[~2008-06-10 17:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-02  7:27 Paul Mundt
2008-06-05 16:26 ` David Howells
2008-06-10 17:30 ` Christoph Lameter [this message]
2008-06-10 18:18   ` Vegard Nossum
2008-06-10 18:30     ` Christoph Lameter
2008-06-11  7:33   ` Paul Mundt
2008-06-11 23:22     ` Christoph Lameter

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=Pine.LNX.4.64.0806101027220.17093@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=cooloney@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=penberg@cs.helsinki.fi \
    /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

all inboxes | Powered by JetHome®