How convert char[] to int in linux kernel
with validation that the text entered is actually an int?
int procfile_write(struct file *file, const char
See the various incarnations of kstrtol() in #include
Which one you need depends on whether the *buffer is a user or a kernel address, and on how strict your needs on error handling / checking of the buffer contents are (things like, is 123qx invalid or should it return 123 ?).