diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index d0ec615ef95ab82b5067e4562e1891f4536ae91a..e945f190b4247e62b26b3c1fd0a3a08657aedd76 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -308,7 +308,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer, unsigned long page_end = (address & PAGE_MASK) + PAGE_SIZE; unsigned long next, avail; int status, wakeBit, page_i, num_contiguous_pages; - int first_page, last_page, requested_pages; + long first_page, last_page, requested_pages; unsigned long xaddr, xaddr_prev, xaddr_i; /* @@ -316,7 +316,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer, */ first_page = address & PAGE_MASK; last_page = (address_end - 1) & PAGE_MASK; - requested_pages = (last_page - first_page + 1); + requested_pages = ((last_page - first_page) >> PAGE_SHIFT) + 1; if (requested_pages > MAX_PAGES_TO_GRAB) { requested_pages = MAX_PAGES_TO_GRAB; }