Skip to contentSkip to conversation

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

DISCUSSION Arjan van de Ven 1 participant 1 message Apr 26, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 4 lines · Linux Kernel Mailing List

void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area) {

(quoted diff) +0 -0
 	void *pt;

Review

Quoted 10 lines
(quoted diff) +2 -2
 
-	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.