Date: Wed, 22 Sep 2010 19:08:17 +0000 (UTC) From: Weongyo Jeong <weongyo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r213010 - user/weongyo/usb/sys/dev/usb Message-ID: <201009221908.o8MJ8HNJ039894@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: weongyo Date: Wed Sep 22 19:08:17 2010 New Revision: 213010 URL: http://svn.freebsd.org/changeset/base/213010 Log: Returns with correct buffer length for a single page case. In the previous there was no way to check the boundary because the length was always -1. Modified: user/weongyo/usb/sys/dev/usb/usb_busdma.c Modified: user/weongyo/usb/sys/dev/usb/usb_busdma.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_busdma.c Wed Sep 22 19:08:11 2010 (r213009) +++ user/weongyo/usb/sys/dev/usb/usb_busdma.c Wed Sep 22 19:08:17 2010 (r213010) @@ -78,10 +78,11 @@ static void usb_pc_common_mem_cb(void *, * been properly initialized ! *------------------------------------------------------------------------*/ void -usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset, +usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset0, struct usb_page_search *res) { struct usb_page *page; + usb_frlength_t offset = offset0; int index; #if USB_HAVE_BUSDMA @@ -106,7 +107,10 @@ usbd_get_page(struct usb_page_cache *pc, res->length = USB_PAGE_SIZE - offset; res->physaddr = page[index].physaddr + offset; } else { - res->length = 0 - 1; + USB_ASSERT(page[index].physlen > offset0, + ("wrong offset (%zd/ %d)", page[index].physlen, + offset0)); + res->length = page[index].physlen - offset0; res->physaddr = page[index].physaddr + offset; } if (!pc->buffer) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009221908.o8MJ8HNJ039894>