[CHECKER] [PATCH] zortran user-pointer fix

From: Hollis Blanchard (hollis@austin.ibm.com)
Date: Tue May 27 2003 - 13:13:25 EST


Here's what the Stanford checker said:
---------------------------------------------------------
[BUG] proc_dir_entry.write_proc

/home/junfeng/linux-2.5.63/drivers/media/video/ zoran_procfs.c:122:zoran_write_proc:
ERROR:TAINTED:122:122: passing tainted ptr 'buffer' to __memcpy
[Callstack:
/home/junfeng/linux-2.5.63/net/core/ pktgen.c:991:zoran_write_proc((tainted
1))]

string = sp = vmalloc(count + 1);
if (!string) {
printk(KERN_ERR "%s: write_proc: can not allocate
memory\n", zr->name);
return -ENOMEM;
}

Error --->
memcpy(string, buffer, count);
string[count] = 0;
DEBUG2(printk(KERN_INFO "%s: write_proc: name=%s count=%lu
data=%x\n", zr->name, file->f_dentry->d_name.name, count, (int) data));
ldelim = " \t\n";
---------------------------------------------------------

Is this patch correct?

--
Hollis Blanchard
IBM Linux Technology Center

Attachment: zortan-memcpy.diff
Description: Binary data