All pastes #2054957 Raw Edit

Untitled

public text v1 · immutable
#2054957 ·published 2011-05-07 20:20 UTC
rendered paste body
int
my_write(struct file *file, const char __user *ubuf, unsigned long count, void *data)
{
    char buf[MAX_LENGTH]; //64 bytes
    int i;
    
    int ret = copy_from_user(&buf, ubuf, count);
    if (ret != 0) {
        printk(KERN_INFO "my_write: error copying data from userspace. ret=%d\n", ret);
        return -EFAULT;
    }

    return count;
}