[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1107211127050.3995@router.home>
Date: Thu, 21 Jul 2011 11:28:04 -0500 (CDT)
From: Christoph Lameter <cl@...ux.com>
To: Vasiliy Kulikov <segoon@...nwall.com>
cc: linux-kernel@...r.kernel.org, Pekka Enberg <penberg@...nel.org>,
Matt Mackall <mpm@...enic.com>, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...e.hu>,
Greg Kroah-Hartman <gregkh@...e.de>,
Al Viro <viro@...iv.linux.org.uk>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [RFC v3 2/5] slab: implement slab object boundaries assertion
On Thu, 21 Jul 2011, Vasiliy Kulikov wrote:
> +bool slab_access_ok(const void *ptr, unsigned long len)
> +{
> + struct page *page;
> + struct kmem_cache *s = NULL;
Useless assignment.
> + unsigned long offset;
> +
> + if (!virt_addr_valid(ptr))
> + return true;
> + page = virt_to_head_page(ptr);
> + if (!PageSlab(page))
> + return true;
> +
> + s = page->slab;
> + offset = (ptr - page_address(page)) % s->size;
> + if (offset <= s->objsize && len <= s->objsize - offset)
> + return true;
I thought this was going to be offset < s->objectsize ...?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists