I try to get strings from userspace within the kernel module. Till I set my char size manually it seems working properly. However, I need to make it dynamic so if I use len parameter it shows weird symbols on the end of char.
static ssize_t msecurity_write(struct file *filep, const char *buffer, size_t len, loff_t *offset){
char chars[12];
if(copy_from_user(chars,buffer,len)){
return -EFAULT;
}
printk(KERN_ALERT "Output> %s", chars);
printk(KERN_ALERT "lengh> %i", len);
return len;
}
First output is for char[len] secound has been set manualy char[12]. Even if you print len it shows value of 12.
