Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ide: Fix IDE PIO size calculation

IDE PIO calculates the size wrong when passing the parameter
"ide-core.nodma=0.0" to the kernel.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>

Signed-off-by: Steven J. Hill <sjhill@mips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Steven J. Hill and committed by
David S. Miller
1581208b 99bfdd87

+2 -3
+2 -3
drivers/ide/ide-taskfile.c
··· 239 239 unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs); 240 240 int page_is_high; 241 241 242 - if (nr_bytes > PAGE_SIZE) 243 - nr_bytes = PAGE_SIZE; 244 - 245 242 page = sg_page(cursg); 246 243 offset = cursg->offset + cmd->cursg_ofs; 247 244 248 245 /* get the current page and offset */ 249 246 page = nth_page(page, (offset >> PAGE_SHIFT)); 250 247 offset %= PAGE_SIZE; 248 + 249 + nr_bytes = min_t(unsigned, nr_bytes, (PAGE_SIZE - offset)); 251 250 252 251 page_is_high = PageHighMem(page); 253 252 if (page_is_high)