Re: [RFC] fix slub krealloc()

From: Christoph Lameter
Date: Mon Jul 23 2007 - 17:37:34 EST


On Mon, 23 Jul 2007 13:47:13 -0700
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:


> > Right. We need to fix util.c. ksize should not be called with a NULL
> > parameter.
> > Index: linux-2.6/mm/util.c
> > ===================================================================
> > --- linux-2.6.orig/mm/util.c 2007-07-23 13:29:42.000000000
> > -0700 +++ linux-2.6/mm/util.c 2007-07-23 13:31:28.000000000
> > -0700 @@ -88,7 +88,11 @@ void *krealloc(const void *p, size_t new
> > return ZERO_SIZE_PTR;
> > }
> >
> > - ks = ksize(p);
> > + if (p)
> > + ks = ksize(p);
> > + else
> > + ks = 0;
> > +
> > if (ks >= new_size)
> > return (void *)p;
> >
>
> I think we already fixed this?
>
> commit 1d4ec7b1d6f130818f9b62dea3411d9ee2ff6ff6
> Author: Roland Dreier <rdreier@xxxxxxxxx>
> Date: Fri Jul 20 12:13:20 2007 -0700
>
> Fix ZERO_OR_NULL_PTR(ZERO_SIZE_PTR)

There is no use of ZERO_OR_NULL ptr in krealloc. Linus added a check to
ksize() instead so that ksize(NULL) returns 0 instead of failing.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/