I always thought copy_to_user
was necessary when the kernel writes to users via procfs.
I forgot to do it once though (and I used snprintf
) and everything was working fine. Now that I noticed it, I have been searching. I found this link that doesn't say copy_to_user
is needed even though for the other section (kernel reading from user) it does say copy_from_user
is necessary.
So, is the buffer provided to kernel module to write data (so user reads from it), in kernel space already? Is it true that you don't need copy_to_user
when writing through procfs? Or have I been lucky not to get a crash?