
< 	kern_buf = memdup_user(buf, nbytes);
---
+ 	if (nbytes == 0 || nbytes > PAGE_SIZE)
+ 		return -EINVAL;
+ 	kern_buf = memdup_user(buf, nbytes);
