lkml.org 
[lkml]   [2008]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference
From
Date

On Fri, 2008-07-25 at 09:39 +0800, Herbert Xu wrote:
> On Thu, Jul 24, 2008 at 12:47:19PM -0500, Matt Mackall wrote:
> >
> > Let's try this again: did you know that ksize could fail depending on
> > kernel configuration? Most of us would answer no. That suggests the API
> > is bad. This ranks 12 on Rusty's spectrum of user-friendly APIs:
>
> I think you misunderstood my argument. I never suggested changing
> the existing ksize interface to return an error onto unsuspecting
> users. I suggested creating a new interface that is explicitly
> designed to return an error if the underlying implementation
> is unable to support this.

I think that could probably be made to work. Perhaps something like:

size_t kmalloc_extra(void *); /* how many extra bytes in this kmalloc?
*/

Which, if it didn't work, could return a nice safe 0. We could argue
about signedness a bit, but I think this would always be safe.

This will also work with all our current kmalloc implementations. The
trouble was calling ksize() on kmem_cache_alloc objects, which happens
to work with SLAB and SLOB.

--
Mathematics is the supreme nostalgia of our time.



\
 
 \ /
  Last update: 2008-07-25 05:05    [W:0.177 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site