Date: Mon, 14 Sep 2015 19:32:04 +0000 (UTC) From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r287800 - stable/10/sys/dev/xen/blkfront Message-ID: <201509141932.t8EJW4pA034128@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cperciva Date: Mon Sep 14 19:32:04 2015 New Revision: 287800 URL: https://svnweb.freebsd.org/changeset/base/287800 Log: MFC r284615, r284662 Code cleanup; fix an error code; add a KASSERT. Modified: stable/10/sys/dev/xen/blkfront/blkfront.c Modified: stable/10/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/10/sys/dev/xen/blkfront/blkfront.c Mon Sep 14 19:23:00 2015 (r287799) +++ stable/10/sys/dev/xen/blkfront/blkfront.c Mon Sep 14 19:32:04 2015 (r287800) @@ -168,7 +168,6 @@ xbd_queue_cb(void *arg, bus_dma_segment_ uint64_t fsect, lsect; int ref; int op; - int block_segs; cm = arg; sc = cm->cm_sc; @@ -180,6 +179,9 @@ xbd_queue_cb(void *arg, bus_dma_segment_ return; } + KASSERT(nsegs <= BLKIF_MAX_SEGMENTS_PER_REQUEST, + ("Too many segments in a blkfront I/O")); + /* Fill out a communications ring structure. */ ring_req = RING_GET_REQUEST(&sc->xbd_ring, sc->xbd_ring.req_prod_pvt); sc->xbd_ring.req_prod_pvt++; @@ -190,9 +192,8 @@ xbd_queue_cb(void *arg, bus_dma_segment_ ring_req->nr_segments = nsegs; cm->cm_nseg = nsegs; - block_segs = MIN(nsegs, BLKIF_MAX_SEGMENTS_PER_REQUEST); sg = ring_req->seg; - last_block_sg = sg + block_segs; + last_block_sg = sg + nsegs; sg_ref = cm->cm_sg_refs; while (sg < last_block_sg) { @@ -227,7 +228,6 @@ xbd_queue_cb(void *arg, bus_dma_segment_ sg++; sg_ref++; segs++; - nsegs--; } if (cm->cm_operation == BLKIF_OP_READ) @@ -1130,7 +1130,7 @@ xbd_initialize(struct xbd_softc *sc) M_XENBLOCKFRONT, M_NOWAIT|M_ZERO); if (sc->xbd_shadow == NULL) { bus_dma_tag_destroy(sc->xbd_io_dmat); - xenbus_dev_fatal(sc->xbd_dev, error, + xenbus_dev_fatal(sc->xbd_dev, ENOMEM, "Cannot allocate request structures\n"); return; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509141932.t8EJW4pA034128>