* Re: Merge with DRI CVS tree: remove stale old context switching code and
[not found] <200304260008.h3Q08gYK005886@hera.kernel.org>
@ 2003-04-26 9:03 ` Arjan van de Ven
0 siblings, 0 replies; only message in thread
From: Arjan van de Ven @ 2003-04-26 9:03 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: torvalds
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
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.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] only message in thread