lkml.org 
[lkml]   [2003]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Merge with DRI CVS tree: remove stale old context switching code and
From
Date
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.



[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:35    [W:0.052 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site