
< 	char *buf;
< 	buf = kzalloc(bufsize, GFP_KERNEL);
---
> 	char *buf;
> 	buf = kzalloc(bufsize, GFP_KERNEL);
> 	if (buf) {
> 		unsigned int buf_size = bufsize; // store the actual size of the allocated memory
> 		while (i < buf_size && (pg - page < len) &&
