Re: Merge with DRI CVS tree: remove stale old context switching code and

From: Arjan van de Ven (arjanv@redhat.com)
Date: Sat Apr 26 2003 - 04:03:05 EST


On Sat, 2003-04-26 at 00:58, Linux Kernel Mailing List wrote:

>
> void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
> {
> void *pt;
>
> - if (!(pt = DRM(alloc)(size, area))) return NULL;
> + if (!(pt = kmalloc(size, GFP_KERNEL))) return NULL;
> if (oldpt && oldsize) {
> memcpy(pt, oldpt, oldsize);
> - DRM(free)(oldpt, oldsize, area);
> + kfree(oldpt);
> }
> return pt;
> }

this looks like buggy code, if you use realloc to shrink the allocation
the memcpy overwrites random memory.



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



This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:23 EST